diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-04-20 19:24:21 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-04-20 19:27:29 +0200 |
| commit | a08291b1586858fc894a27d56f55f87a88f8dbd3 (patch) | |
| tree | 0aa36c8add0ad0ecc07c0f7f20f5af3e2f7abe46 /src/components/organisms/toolbar/main-nav.stories.tsx | |
| parent | 362cf45bc520a68a1c1be20e1189ca2307577dde (diff) | |
refactor(storybook): reorganize design system
Add more stories for each components and change some components
categories for better organization.
Diffstat (limited to 'src/components/organisms/toolbar/main-nav.stories.tsx')
| -rw-r--r-- | src/components/organisms/toolbar/main-nav.stories.tsx | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/src/components/organisms/toolbar/main-nav.stories.tsx b/src/components/organisms/toolbar/main-nav.stories.tsx index 27387c0..04b22cb 100644 --- a/src/components/organisms/toolbar/main-nav.stories.tsx +++ b/src/components/organisms/toolbar/main-nav.stories.tsx @@ -1,11 +1,14 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import { useState } from 'react'; import { IntlProvider } from 'react-intl'; -import MainNavComponent from './main-nav'; +import MainNav from './main-nav'; +/** + * MainNav - Storybook Meta + */ export default { - title: 'Organisms/Toolbar', - component: MainNavComponent, + title: 'Organisms/Toolbar/MainNav', + component: MainNav, argTypes: { className: { control: { @@ -49,27 +52,45 @@ export default { }, }, }, -} as ComponentMeta<typeof MainNavComponent>; + decorators: [ + (Story) => ( + <IntlProvider locale="en"> + <Story /> + </IntlProvider> + ), + ], +} as ComponentMeta<typeof MainNav>; -const Template: ComponentStory<typeof MainNavComponent> = ({ +const Template: ComponentStory<typeof MainNav> = ({ isActive, setIsActive: _setIsActive, ...args }) => { const [isOpen, setIsOpen] = useState<boolean>(isActive); - return ( - <IntlProvider locale="en"> - <MainNavComponent isActive={isOpen} setIsActive={setIsOpen} {...args} /> - </IntlProvider> - ); + return <MainNav isActive={isOpen} setIsActive={setIsOpen} {...args} />; }; -export const MainNav = Template.bind({}); -MainNav.args = { +/** + * MainNav Stories - Inactive + */ +export const Inactive = Template.bind({}); +Inactive.args = { isActive: false, items: [ { id: 'home', label: 'Home', href: '#' }, { id: 'contact', label: 'Contact', href: '#' }, ], }; + +/** + * MainNav Stories - Active + */ +export const Active = Template.bind({}); +Active.args = { + isActive: true, + items: [ + { id: 'home', label: 'Home', href: '#' }, + { id: 'contact', label: 'Contact', href: '#' }, + ], +}; |
