Skip to content

Commit

Permalink
feat: add bordered props to tabs, update tab slider stories
Browse files Browse the repository at this point in the history
  • Loading branch information
driss-chelouati committed Dec 9, 2023
1 parent 7969142 commit 7911dc8
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/plugins/components/tab-slider/tab-slider.doc.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,13 @@ Tab sliders can have different alignment. Below is an example of the end alignme

Tab sliders can have different sizes. Below is an example of the small size.

<div className="flex items-end gap-2 border border-muted-200 dark:border-muted-800 bg-white dark:bg-slate-900 p-6 rounded-sm">
<Story of={TabSliderStories.SizeSm} />
<div className="space-y-4">
<div className="flex items-end gap-2 border border-muted-200 dark:border-muted-800 bg-white dark:bg-slate-900 p-6 rounded-sm">
<Story of={TabSliderStories.SizeSm} />
</div>
<div className="flex items-end gap-2 border border-muted-200 dark:border-muted-800 bg-white dark:bg-slate-900 p-6 rounded-sm">
<Story of={TabSliderStories.SizeSmFull} />
</div>
</div>

<br />
Expand Down
20 changes: 20 additions & 0 deletions src/plugins/components/tab-slider/tab-slider.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,26 @@ export const SizeSm: Story = {
style: 'max-width: 480px;',
},
}

export const SizeSmFull: Story = {
name: 'Size: sm',
args: {
tabs: data,
size: 'sm',
rounded: 'full',
justify: 'start',
children: html`
<div>
<p class="font-sans text-muted-500 dark:text-muted-400">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quid iudicant
sensus? Primum quid tu dicis breve? Etiam beatissimum? Ne discipulum
abducam, times.
</p>
</div>
`,
style: 'max-width: 480px;',
},
}
// #endregion

// #region Slots
Expand Down
8 changes: 8 additions & 0 deletions src/plugins/components/tabs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ export default plugin.withOptions(
[`@apply font-${config.inner.font.family} mb-${config.inner.margin.bottom} flex`]:
{},
},

//Tabs:bordered
[`&.${prefix}tabs-bordered`]: {
//Tabs:inner
[`.${prefix}tabs-inner`]: {
[`@apply border-b border-muted-200 dark:border-muted-800`]: {},
},
},
//Tabs:item
[`.${prefix}tab-item`]: {
//Base
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/components/tabs/tabs.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const Tabs = ({
type = 'tabs',
justify = 'start',
hideLabel,
bordered = true,
classes,
children,
...attrs
Expand All @@ -21,6 +22,7 @@ export const Tabs = ({
class=${[
'nui-tabs',
justify && variants.justify[justify],
type === 'tabs' && bordered && 'nui-tabs-bordered',
classes?.wrapper,
]
.filter(Boolean)
Expand All @@ -41,7 +43,6 @@ export const Tabs = ({
.join(' ')}
tabindex="0"
>
<!--Icon v-if="tab.icon" :name="tab.icon" class="me-1 block h-5 w-5" /-->
<span
class=${[
'nui-tabs',
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/components/tabs/tabs.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ const meta = {
options: ['start', 'center', 'end'],
defaultValue: 'start',
},
bordered: {
name: 'Bordered',
control: { type: 'boolean' },
defaultValue: true,
},
},
} satisfies Meta<TabsAttrs>

Expand Down
1 change: 1 addition & 0 deletions src/plugins/components/tabs/tabs.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface TabsProps extends Record<string, unknown> {
type?: 'tabs' | 'box'
justify?: 'start' | 'center' | 'end'
hideLabel?: boolean
bordered?: boolean
classes?: {
wrapper?: string | string[]
inner?: string | string[]
Expand Down

0 comments on commit 7911dc8

Please sign in to comment.