chore(Tabs): use preset system

This commit is contained in:
Benjamin Canac
2022-02-22 11:42:06 +01:00
parent 5fb7f10283
commit 3d9ead3d8d
4 changed files with 53 additions and 22 deletions

View File

@@ -274,6 +274,22 @@ const defaultProps = {
html: 'Popover content' html: 'Popover content'
} }
} }
},
Tabs: {
links: [{
label: 'Usage',
to: '/',
exact: true
}, {
label: 'Examples',
to: '/examples'
}, {
label: 'Migration',
to: '/migration'
}, {
label: 'Tabs',
to: '/components/Tabs'
}]
} }
} }

View File

@@ -192,7 +192,10 @@ const components = [
}, },
{ {
label: 'Tabs', label: 'Tabs',
to: '/components/Tabs' to: '/components/Tabs',
nuxt3: true,
capi: true,
preset: true
}, },
{ {
label: 'VerticalNavigation', label: 'VerticalNavigation',

View File

@@ -1,11 +1,11 @@
<template> <template>
<nav class="flex items-center gap-6"> <nav :class="wrapperClass">
<Link <Link
v-for="(link, index) of links" v-for="(link, index) of links"
:key="index" :key="index"
:to="link.to" :to="link.to"
:exact="link.exact" :exact="link.exact"
class="pt-2 pb-3 text-sm font-medium border-b-2 whitespace-nowrap" :class="baseClass"
:active-class="activeClass" :active-class="activeClass"
:inactive-class="inactiveClass" :inactive-class="inactiveClass"
> >
@@ -14,26 +14,30 @@
</nav> </nav>
</template> </template>
<script> <script setup>
import Link from '../elements/Link' import Link from '../elements/Link'
import $ui from '#build/ui'
export default { defineProps({
components: { links: {
Link type: Array,
required: true
}, },
props: { wrapperClass: {
links: { type: String,
type: Array, default: () => $ui.tabs.wrapper
required: true },
}, baseClass: {
activeClass: { type: String,
type: String, default: () => $ui.tabs.base
default: 'u-border-black u-text-black hover:text-black dark:hover:text-white hover:border-black dark:hover:border-white' },
}, activeClass: {
inactiveClass: { type: String,
type: String, default: () => $ui.tabs.active
default: 'border-transparent u-text-gray-500 hover:u-text-gray-700 hover:u-border-gray-300' },
} inactiveClass: {
type: String,
default: () => $ui.tabs.inactive
} }
} })
</script> </script>

View File

@@ -293,6 +293,13 @@ const dropdown = {
} }
} }
const tabs = {
wrapper: 'flex items-center gap-6',
base: 'pt-2 pb-3 text-sm font-medium border-b-2 whitespace-nowrap',
active: 'u-border-black u-text-black hover:text-black dark:hover:text-white hover:border-black dark:hover:border-white',
inactive: 'border-transparent u-text-gray-500 hover:u-text-gray-700 hover:u-border-gray-300'
}
export default { export default {
card, card,
button, button,
@@ -308,5 +315,6 @@ export default {
toggle, toggle,
verticalNavigation, verticalNavigation,
alertDialog, alertDialog,
dropdown dropdown,
tabs
} }