From 1ee12833f44d9b0bf7ef76594805dfd672609f0d Mon Sep 17 00:00:00 2001 From: Jin Yi Date: Wed, 22 Oct 2025 13:26:24 +0900 Subject: [PATCH] feature: tab storybook added --- src/components/tab/TabList.stories.ts | 153 ++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 src/components/tab/TabList.stories.ts diff --git a/src/components/tab/TabList.stories.ts b/src/components/tab/TabList.stories.ts new file mode 100644 index 000000000..96ae14cc4 --- /dev/null +++ b/src/components/tab/TabList.stories.ts @@ -0,0 +1,153 @@ +import type { Meta, StoryObj } from '@storybook/vue3-vite' +import { ref } from 'vue' + +import Tab from './Tab.vue' +import TabList from './TabList.vue' + +const meta: Meta = { + title: 'Components/Tab/TabList', + component: TabList, + tags: ['autodocs'], + argTypes: { + modelValue: { + control: 'text', + description: 'The currently selected tab value' + }, + 'onUpdate:modelValue': { action: 'update:modelValue' } + } +} + +export default meta +type Story = StoryObj + +export const Default: Story = { + render: (args) => ({ + components: { TabList, Tab }, + setup() { + const activeTab = ref(args.modelValue || 'tab1') + return { activeTab } + }, + template: ` + + Tab 1 + Tab 2 + Tab 3 + +
+ Selected tab: {{ activeTab }} +
+ ` + }), + args: { + modelValue: 'tab1' + } +} + +export const ManyTabs: Story = { + render: () => ({ + components: { TabList, Tab }, + setup() { + const activeTab = ref('tab1') + return { activeTab } + }, + template: ` + + Dashboard + Analytics + Reports + Settings + Profile + +
+ Selected tab: {{ activeTab }} +
+ ` + }) +} + +export const WithIcons: Story = { + render: () => ({ + components: { TabList, Tab }, + setup() { + const activeTab = ref('home') + return { activeTab } + }, + template: ` + + + + Home + + + + Users + + + + Settings + + +
+ Selected tab: {{ activeTab }} +
+ ` + }) +} + +export const LongLabels: Story = { + render: () => ({ + components: { TabList, Tab }, + setup() { + const activeTab = ref('overview') + return { activeTab } + }, + template: ` + + Project Overview + Documentation & Guides + Deployment Settings + Monitoring & Analytics + +
+ Selected tab: {{ activeTab }} +
+ ` + }) +} + +export const Interactive: Story = { + render: () => ({ + components: { TabList, Tab }, + setup() { + const activeTab = ref('input') + const handleTabChange = (value: string) => { + console.log('Tab changed to:', value) + } + return { activeTab, handleTabChange } + }, + template: ` +
+
+

Example: Media Assets

+ + Imported + Generated + +
+ +
+
+

Showing imported assets...

+
+
+

Showing generated assets...

+
+
+ +
+ Current tab value: {{ activeTab }} +
+
+ ` + }) +}