diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-12-15 18:35:16 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-12-15 18:49:49 +0100 |
| commit | 0f936ec0e7606cb79434d94096b6e113a7ce78eb (patch) | |
| tree | 465ec7f66ac9459be6a18ac046e10357814c7b92 /src/components/organisms/forms/search-form | |
| parent | 4e4d2eb25365be861e19f9756cf334ba2faa6911 (diff) | |
refactor(stories): migrate stories to CSF3 format
Diffstat (limited to 'src/components/organisms/forms/search-form')
| -rw-r--r-- | src/components/organisms/forms/search-form/search-form.stories.ts | 30 | ||||
| -rw-r--r-- | src/components/organisms/forms/search-form/search-form.stories.tsx | 46 |
2 files changed, 30 insertions, 46 deletions
diff --git a/src/components/organisms/forms/search-form/search-form.stories.ts b/src/components/organisms/forms/search-form/search-form.stories.ts new file mode 100644 index 0000000..203d4a6 --- /dev/null +++ b/src/components/organisms/forms/search-form/search-form.stories.ts @@ -0,0 +1,30 @@ +import type { Meta, StoryObj } from '@storybook/react'; +import { SearchForm, type SearchFormSubmit } from './search-form'; + +const meta = { + component: SearchForm, + title: 'Organisms/Forms/Search', +} satisfies Meta<typeof SearchForm>; + +export default meta; + +type Story = StoryObj<typeof meta>; + +const search: SearchFormSubmit = () => { + console.log('Searching!'); + + return undefined; +}; + +export const Example: Story = { + args: { + onSubmit: search, + }, +}; + +export const WithLabelHidden: Story = { + args: { + isLabelHidden: true, + onSubmit: search, + }, +}; diff --git a/src/components/organisms/forms/search-form/search-form.stories.tsx b/src/components/organisms/forms/search-form/search-form.stories.tsx deleted file mode 100644 index d8e4339..0000000 --- a/src/components/organisms/forms/search-form/search-form.stories.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import type { ComponentMeta, ComponentStory } from '@storybook/react'; -import { SearchForm } from './search-form'; - -/** - * SearchForm - Storybook Meta - */ -export default { - title: 'Organisms/Forms/Search', - component: SearchForm, - argTypes: { - isLabelHidden: { - control: { - type: 'boolean', - }, - description: 'Determine if the input label should be visually hidden.', - table: { - category: 'Options', - defaultValue: { summary: false }, - }, - type: { - name: 'boolean', - required: false, - }, - }, - }, -} as ComponentMeta<typeof SearchForm>; - -const Template: ComponentStory<typeof SearchForm> = (args) => ( - <SearchForm {...args} /> -); - -/** - * SearchForm Stories - Default - */ -export const Default = Template.bind({}); -Default.args = { - isLabelHidden: false, -}; - -/** - * SearchForm Stories - With hidden label - */ -export const WithHiddenLabel = Template.bind({}); -WithHiddenLabel.args = { - isLabelHidden: true, -}; |
