Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | import React, { useState } from 'react'; import { Story } from '@storybook/react'; import Tabs, { TabsProps } from '../components/Tabs'; export default { title: 'Tabs', component: Tabs, }; const Template: Story<TabsProps> = (args) => { const { tabs } = args; return <Tabs tabs={tabs} />; }; const OverrideTemplate: Story<TabsProps> = (args) => { const [activeTab, setActiveTab] = useState<string>('tab1'); const onTabChange = (tab: string) => { if (tab !== 'tab3') { setActiveTab(tab); } }; return <Tabs {...args} activeTab={activeTab} onTabChange={onTabChange} />; }; export const Default = Template.bind({}); Default.args = { tabs: [ { icon: 'iconParchment', id: 'tab1', label: 'Tab1', children: 'tab1 contents', disabled: false }, { id: 'tab2', label: 'Tab2', children: 'tab2 contents', disabled: false }, ], }; export const OverrideActiveTab = OverrideTemplate.bind({}); OverrideActiveTab.args = { tabs: [ { id: 'tab1', label: 'Tab1', children: 'tab1 contents', disabled: false }, { id: 'tab2', label: 'Tab2', children: 'tab2 contents', disabled: false }, { id: 'tab3', label: 'Tab3', children: 'tab3 contents', disabled: false }, ], }; |