Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(inline classes): update inline classes #46

Merged
merged 1 commit into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion components/attention/w-attention.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
const emit = defineEmits(['update:modelValue']);
const directionName = computed(() => directions.find(e => props[e]));

const attentionClasses = computed(() => ({
[props.attentionClass]: true,
[ccAttention.notCallout]: !props.callout
}))

const wrapperClasses = computed(() => ({
[ccAttention.base]: true,
[ccAttention.tooltip]: props.tooltip,
Expand Down Expand Up @@ -66,7 +71,7 @@
</script>

<template>
<div :class="[{ 'absolute z-50': !callout }, attentionClass]" ref="attentionRef" v-show="model">
<div :class="attentionClasses" ref="attentionRef" v-show="model">
<div :class="wrapperClasses" data-test="wrapper">
<w-attention-arrow v-bind="$props" v-if="!noArrow" ref="arrowEl" :direction="actualDirection" />
<div :class="ccAttention.content"><slot /></div>
Expand Down
3 changes: 2 additions & 1 deletion components/expandable/w-expandable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const chevronClasses = computed(() => ({

const contentClasses = computed(() => ({
[props.contentClass || '']: true,
[ccBox.box + (hasTitle.value ? ' pt-0' : '')]: props.box || props.info,
[ccBox.box]: props.box || props.info,
[ccExpandable.paddingTop]: hasTitle.value && (props.box || props.info),
}))
</script>
11 changes: 9 additions & 2 deletions components/steps/w-steps.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup>
import { ref, provide, watchEffect } from 'vue';
import { computed, ref, provide, watchEffect } from 'vue';
import { steps as ccSteps } from '@warp-ds/component-classes';

const props = defineProps({
horizontal: Boolean,
Expand All @@ -12,14 +13,20 @@ const left = ref(!props.right);
provide('steps-vertical', vertical);
provide('steps-left', left);

const stepsClasses = computed(() => ({
[ccSteps.steps]: true,
[ccSteps.stepsHorizontal]: props.horizontal
}));

watchEffect(() => {
vertical.value = !props.horizontal;
left.value = !props.right;
});

</script>

<template>
<div class="w-full" :class="{ flex: horizontal }">
<div :class="stepsClasses">
<slot />
</div>
</template>
Expand Down
1 change: 0 additions & 1 deletion components/tabs/w-tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
provide,
computed,
ref,
toRef,
watch,
nextTick,
onMounted,
Expand Down
46 changes: 24 additions & 22 deletions components/tag/w-tag.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
<template>
<div :class="baseClasses">
<slot />
</div>
</template>

<script>
export default { name: 'wTag' }
</script>

<script setup>
import { ribbon as c } from '@fabric-ds/css/component-classes'
import { ribbon as ccRibbon } from '@warp-ds/component-classes'
import { computed } from 'vue'

const props = defineProps({
Expand All @@ -28,18 +18,30 @@ const props = defineProps({
disabled: Boolean,
sponsored: Boolean,
neutral: Boolean
})
});

const baseClasses = computed(() => ({
[c.base]: props.primary,
['rounded-tr-0 rounded-bl-0']: props.topLeft || props.bottomRight,
['rounded-tl-0 rounded-br-0']: props.topRight || props.bottomLeft,
[c.info]: props.info,
[c.success]: props.success,
[c.warning]: props.warning,
[c.error]: props.error,
[c.disabled]: props.disabled,
[c.sponsored]: props.sponsored,
[c.neutral]: props.neutral
[ccRibbon.base]: props.primary,
[ccRibbon.roundedTopRightBottomLeft]: props.topLeft || props.bottomRight,
[ccRibbon.roundedTopLeftBottomRight]: props.topRight || props.bottomLeft,
[ccRibbon.info]: props.info,
[ccRibbon.success]: props.success,
[ccRibbon.warning]: props.warning,
[ccRibbon.error]: props.error,
[ccRibbon.disabled]: props.disabled,
[ccRibbon.sponsored]: props.sponsored,
[ccRibbon.neutral]: props.neutral
}))
</script>

<template>
<div :class="baseClasses">
<slot />
</div>
</template>

<script>
export default { name: 'wTag' }
</script>


29 changes: 14 additions & 15 deletions dev/pages/Tabs.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup>
import { wTabs, wTab, wTabPanel } from '#components';
import { radio, useIsActive } from '#dev-util';
import { ref, reactive, h } from 'vue';
import { ref, h } from 'vue';

const Stars = {
name: 'stars-svg',
Expand All @@ -12,34 +11,34 @@ const Stars = {
}),
};

const model = ref('home');
const model = ref('one');
</script>

<template>
<div>
<component-title title="Tabs" />
<token :state="[model]">
<w-tabs v-model="model">
<w-tab label="Home" name="home">
<w-tab label="Tab 1" name="one">
<stars />
</w-tab>
<w-tab label="Car" name="car">
<w-tab label="Tab 2" name="two">
<stars />
</w-tab>
<w-tab label="Motorcycle" name="motorcycle">
<w-tab label="Tab 3" name="three">
<stars />
</w-tab>
</w-tabs>
<div>
<w-tab-panel name="home" v-if="model === 'home'"
><h3 class="mb-0">Welcome home!</h3></w-tab-panel
>
<w-tab-panel name="car" v-if="model === 'car'"
><h3 class="mb-0">I am a car page</h3></w-tab-panel
>
<w-tab-panel name="motorcycle" v-if="model === 'motorcycle'"
><h3 class="mb-0">Something something two wheels</h3></w-tab-panel
>
<w-tab-panel name="one" v-if="model === 'one'">
<p class="mb-0">First tab content</p>
</w-tab-panel>
<w-tab-panel name="two" v-if="model === 'two'">
<p class="mb-0">Second tab content</p>
</w-tab-panel>
<w-tab-panel name="three" v-if="model === 'three'">
<p class="mb-0">Third tab content</p>
</w-tab-panel>
</div>
</token>
</div>
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
"@vue/compiler-sfc": "^3.2.37",
"@vue/test-utils": "^2.0.2",
"@warp-ds/core": "^1.0.0",
"@warp-ds/component-classes": "^1.0.0-alpha.101",
"@warp-ds/uno": "1.0.0-alpha.41",
"@warp-ds/component-classes": "^1.0.0-alpha.106",
"@warp-ds/uno": "1.0.0-alpha.45",
"cleave-lite": "^1.0.0",
"cz-conventional-changelog": "^3.3.0",
"drnm": "^0.9.0",
Expand Down
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.