diff --git a/src/components/Tabs/Tabs.stories.tsx b/src/components/Tabs/Tabs.stories.tsx index a2293318..4ee85fd4 100644 --- a/src/components/Tabs/Tabs.stories.tsx +++ b/src/components/Tabs/Tabs.stories.tsx @@ -1,33 +1,101 @@ import React from 'react'; -import { ComponentStory, ComponentMeta } from '@storybook/react'; +import { StoryObj, StoryFn, Meta } from '@storybook/react'; import { Tabs } from './Tabs'; import { TabList } from './TabList'; import { Tab } from './Tab'; import { TabPanel } from './TabPanel'; -export default { - title: 'Components/Tabs', +const meta: Meta = { component: Tabs, - argTypes: {}, - subcomponents: { Tab, TabList, TabPanel }, -} as ComponentMeta; +}; +export default meta; +type Story = StoryObj; + +export const Default: Story = { + args: { + children: ( + <> + + Tab 1 Pill + Tab 2 Pill + + Tab 3 Pill + + + Tab 1 selected + Tab 2 selected + + ), + }, +}; -const Template: ComponentStory = (args) => ; +const TemplateManual: StoryFn = (args) => { + const [activeTab, setActiveTab] = React.useState('tab1'); + const [content, setContent] = React.useState( + 'No side effect has been called yet...' + ); -export const Default = Template.bind({}); -Default.args = { - children: ( + return ( <> - - Tab 1 Pill - Tab 2 Pill - - Tab 3 Pill - - - Tab 2 selected - Tab 1 selected + + + { + setActiveTab('tab1'); + setContent('Some side effect from tab 1'); + }} + > + Tab 1 Pill + + { + setActiveTab('tab2'); + setContent('Some side effect from tab 2'); + }} + > + Tab 2 Pill + + { + setActiveTab('tab3'); + setContent('Some side effect from tab 3'); + }} + > + Tab 3 Pill + + + +

Tab 1 content

+
+ +

Tab 2 content

+
+ +

Tab 3 content

+
+
+
+

{content}

+
- ), + ); +}; + +export const ManualControl: Story = { + render: TemplateManual, + args: { + manualControl: true, + }, + parameters: { + docs: { + description: { + story: + 'Manual control allows you to run side effects by handling tab change manually with an onClick() on each tab', + }, + }, + }, }; diff --git a/src/components/Text/Text.stories.tsx b/src/components/Text/Text.stories.tsx index 8e4c6cae..4768ea93 100644 --- a/src/components/Text/Text.stories.tsx +++ b/src/components/Text/Text.stories.tsx @@ -1,35 +1,32 @@ -import React from 'react'; -import { ComponentStory, ComponentMeta } from '@storybook/react'; +import { StoryObj, Meta } from '@storybook/react'; import { Text } from './Text'; -export default { - title: 'Components/Text', +const meta: Meta = { component: Text, - argTypes: {}, -} as ComponentMeta; - -const Template: ComponentStory = (args) => ; - -export const Default = Template.bind({}); -Default.args = { - children: 'Text', + args: { + children: 'Text', + }, }; +export default meta; +type Story = StoryObj; -export const InverseDark = Template.bind({}); -InverseDark.parameters = { - backgrounds: { default: 'dark' }, -}; -InverseDark.args = { - children: 'Text', - color: 'inverse', -}; +export const Default: Story = {}; -export const InverseBlue = Template.bind({}); -InverseBlue.parameters = { - backgrounds: { default: 'blue' }, +export const InverseDark: Story = { + parameters: { + backgrounds: { default: 'dark' }, + }, + args: { + color: 'inverse', + }, }; -InverseBlue.args = { - children: 'Text', - color: 'inverse', + +export const InverseBlue: Story = { + parameters: { + backgrounds: { default: 'blue' }, + }, + args: { + color: 'inverse', + }, }; diff --git a/src/components/TextArea/TextArea.stories.tsx b/src/components/TextArea/TextArea.stories.tsx index 0e3bd87e..45af8a15 100644 --- a/src/components/TextArea/TextArea.stories.tsx +++ b/src/components/TextArea/TextArea.stories.tsx @@ -1,81 +1,79 @@ -import React from 'react'; -import { ComponentStory, ComponentMeta } from '@storybook/react'; +import { StoryObj, Meta } from '@storybook/react'; import { TextArea } from './TextArea'; import { HelpCircle } from '@lifeomic/chromicons'; -export default { +const meta: Meta = { title: 'Form Components/TextArea', component: TextArea, - argTypes: {}, -} as ComponentMeta; - -const Template: ComponentStory = (args) => ( -