diff options
Diffstat (limited to 'src/components/molecules/nav')
| -rw-r--r-- | src/components/molecules/nav/breadcrumb.stories.tsx | 60 | ||||
| -rw-r--r-- | src/components/molecules/nav/nav.stories.tsx | 42 |
2 files changed, 72 insertions, 30 deletions
diff --git a/src/components/molecules/nav/breadcrumb.stories.tsx b/src/components/molecules/nav/breadcrumb.stories.tsx index d283619..500ae6c 100644 --- a/src/components/molecules/nav/breadcrumb.stories.tsx +++ b/src/components/molecules/nav/breadcrumb.stories.tsx @@ -1,10 +1,13 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import { IntlProvider } from 'react-intl'; -import BreadcrumbComponent, { type BreadcrumbItem } from './breadcrumb'; +import Breadcrumb from './breadcrumb'; +/** + * Breadcrumb - Storybook Meta + */ export default { - title: 'Molecules/Nav', - component: BreadcrumbComponent, + title: 'Molecules/Navigation/Breadcrumb', + component: Breadcrumb, argTypes: { className: { control: { @@ -28,21 +31,46 @@ export default { }, }, }, -} as ComponentMeta<typeof BreadcrumbComponent>; + decorators: [ + (Story) => ( + <IntlProvider locale="en"> + <Story /> + </IntlProvider> + ), + ], +} as ComponentMeta<typeof Breadcrumb>; -const Template: ComponentStory<typeof BreadcrumbComponent> = (args) => ( - <IntlProvider locale="en"> - <BreadcrumbComponent {...args} /> - </IntlProvider> +const Template: ComponentStory<typeof Breadcrumb> = (args) => ( + <Breadcrumb {...args} /> ); -const items: BreadcrumbItem[] = [ - { id: 'home', url: '#', name: 'Home' }, - { id: 'blog', url: '#', name: 'Blog' }, - { id: 'post1', url: '#', name: 'A Post' }, -]; +/** + * Breadcrumb Stories - One item + */ +export const OneItem = Template.bind({}); +OneItem.args = { + items: [{ id: 'home', url: '#', name: 'Home' }], +}; + +/** + * Breadcrumb Stories - Two items + */ +export const TwoItems = Template.bind({}); +TwoItems.args = { + items: [ + { id: 'home', url: '#', name: 'Home' }, + { id: 'blog', url: '#', name: 'Blog' }, + ], +}; -export const Breadcrumb = Template.bind({}); -Breadcrumb.args = { - items, +/** + * Breadcrumb Stories - Three items + */ +export const ThreeItems = Template.bind({}); +ThreeItems.args = { + items: [ + { id: 'home', url: '#', name: 'Home' }, + { id: 'blog', url: '#', name: 'Blog' }, + { id: 'post1', url: '#', name: 'A Post' }, + ], }; diff --git a/src/components/molecules/nav/nav.stories.tsx b/src/components/molecules/nav/nav.stories.tsx index 9975bbd..25455fd 100644 --- a/src/components/molecules/nav/nav.stories.tsx +++ b/src/components/molecules/nav/nav.stories.tsx @@ -4,18 +4,11 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import { IntlProvider } from 'react-intl'; import NavComponent, { type NavItem } from './nav'; -const MainNavItems: NavItem[] = [ - { id: 'homeLink', href: '/', label: 'Home', logo: <Home /> }, - { id: 'contactLink', href: '/contact', label: 'Contact', logo: <Envelop /> }, -]; - -const FooterNavItems: NavItem[] = [ - { id: 'contactLink', href: '/contact', label: 'Contact' }, - { id: 'legalLink', href: '/legal-notice', label: 'Legal notice' }, -]; - +/** + * Nav - Storybook Meta + */ export default { - title: 'Molecules/Nav', + title: 'Molecules/Navigation/Nav', component: NavComponent, argTypes: { className: { @@ -54,20 +47,41 @@ export default { }, }, }, + decorators: [ + (Story) => ( + <IntlProvider locale="en"> + <Story /> + </IntlProvider> + ), + ], } as ComponentMeta<typeof NavComponent>; const Template: ComponentStory<typeof NavComponent> = (args) => ( - <IntlProvider locale="en"> - <NavComponent {...args} /> - </IntlProvider> + <NavComponent {...args} /> ); +const MainNavItems: NavItem[] = [ + { id: 'homeLink', href: '/', label: 'Home', logo: <Home /> }, + { id: 'contactLink', href: '/contact', label: 'Contact', logo: <Envelop /> }, +]; + +const FooterNavItems: NavItem[] = [ + { id: 'contactLink', href: '/contact', label: 'Contact' }, + { id: 'legalLink', href: '/legal-notice', label: 'Legal notice' }, +]; + +/** + * Nav Stories - Main navigation + */ export const MainNav = Template.bind({}); MainNav.args = { items: MainNavItems, kind: 'main', }; +/** + * Nav Stories - Footer navigation + */ export const FooterNav = Template.bind({}); FooterNav.args = { items: FooterNavItems, |
