From 0f936ec0e7606cb79434d94096b6e113a7ce78eb Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 15 Dec 2023 18:35:16 +0100 Subject: refactor(stories): migrate stories to CSF3 format --- .../navbar/navbar-item/navbar-item.stories.ts | 30 ++++++ .../navbar/navbar-item/navbar-item.stories.tsx | 38 -------- src/components/organisms/navbar/navbar.stories.tsx | 108 ++++++++------------- 3 files changed, 73 insertions(+), 103 deletions(-) create mode 100644 src/components/organisms/navbar/navbar-item/navbar-item.stories.ts delete mode 100644 src/components/organisms/navbar/navbar-item/navbar-item.stories.tsx (limited to 'src/components/organisms/navbar') diff --git a/src/components/organisms/navbar/navbar-item/navbar-item.stories.ts b/src/components/organisms/navbar/navbar-item/navbar-item.stories.ts new file mode 100644 index 0000000..6311a95 --- /dev/null +++ b/src/components/organisms/navbar/navbar-item/navbar-item.stories.ts @@ -0,0 +1,30 @@ +import type { Meta, StoryObj } from '@storybook/react'; +import { NavbarItem } from './navbar-item'; + +const meta = { + component: NavbarItem, + title: 'Organisms/Navbar/Item', +} satisfies Meta; + +export default meta; + +type Story = StoryObj; + +export const Example: Story = { + args: { + children: 'The modal contents.', + icon: 'cog', + id: 'default', + label: 'Open example', + }, +}; + +export const ModalVisibleAfterBreakpoint: Story = { + args: { + children: 'The modal contents.', + icon: 'cog', + id: 'modal-visible', + label: 'Open example', + modalVisibleFrom: 'md', + }, +}; diff --git a/src/components/organisms/navbar/navbar-item/navbar-item.stories.tsx b/src/components/organisms/navbar/navbar-item/navbar-item.stories.tsx deleted file mode 100644 index 93b7281..0000000 --- a/src/components/organisms/navbar/navbar-item/navbar-item.stories.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import type { ComponentMeta, ComponentStory } from '@storybook/react'; -import { NavbarItem } from './navbar-item'; - -/** - * NavbarItem - Storybook Meta - */ -export default { - title: 'Organisms/Navbar/Item', - component: NavbarItem, - argTypes: {}, -} as ComponentMeta; - -const Template: ComponentStory = (args) => ( - -); - -/** - * NavbarItem Stories - Default - */ -export const Default = Template.bind({}); -Default.args = { - children: 'The modal contents.', - icon: 'cog', - id: 'default', - label: 'Open example', -}; - -/** - * NavbarItem Stories - ModalVisibleAfterBreakpoint - */ -export const ModalVisibleAfterBreakpoint = Template.bind({}); -ModalVisibleAfterBreakpoint.args = { - children: 'The modal contents.', - icon: 'cog', - id: 'modal-visible', - label: 'Open example', - modalVisibleFrom: 'md', -}; diff --git a/src/components/organisms/navbar/navbar.stories.tsx b/src/components/organisms/navbar/navbar.stories.tsx index 95b71ef..a52602e 100644 --- a/src/components/organisms/navbar/navbar.stories.tsx +++ b/src/components/organisms/navbar/navbar.stories.tsx @@ -1,77 +1,55 @@ -import type { ComponentMeta, ComponentStory } from '@storybook/react'; -import { Navbar as NavbarComponent } from './navbar'; +import type { Meta, StoryObj } from '@storybook/react'; +import { Navbar } from './navbar'; import { NavbarItem } from './navbar-item'; -/** - * Navbar - Storybook Meta - */ -export default { +const meta = { + component: Navbar, title: 'Organisms/Navbar', - component: NavbarComponent, - argTypes: { - children: { - description: 'The navbar items.', - type: { - name: 'object', - required: true, - value: {}, - }, - }, - }, - parameters: { - layout: 'fullscreen', - }, -} as ComponentMeta; +} satisfies Meta; -const Template: ComponentStory = (args) => ( - -); +export default meta; -/** - * Navbar Stories - 1 item - */ -export const OneItem = Template.bind({}); -OneItem.args = { - children: ( - - The main nav contents - - ), -}; +type Story = StoryObj; -/** - * Navbar Stories - 2 items - */ -export const TwoItems = Template.bind({}); -TwoItems.args = { - children: ( - <> +export const OneItem: Story = { + args: { + children: ( The main nav contents - - A search form - - - ), + ), + }, }; -/** - * Navbar Stories - 3 items - */ -export const ThreeItems = Template.bind({}); -ThreeItems.args = { - children: ( - <> - - The main nav contents - - - A search form - - - A settings form - - - ), +export const TwoItems: Story = { + args: { + children: ( + <> + + The main nav contents + + + A search form + + + ), + }, +}; + +export const ThreeItems: Story = { + args: { + children: ( + <> + + The main nav contents + + + A search form + + + A settings form + + + ), + }, }; -- cgit v1.2.3