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 --- .../forms/comment-form/comment-form.stories.ts | 23 +++++++++++ .../forms/comment-form/comment-form.stories.tsx | 44 ---------------------- 2 files changed, 23 insertions(+), 44 deletions(-) create mode 100644 src/components/organisms/forms/comment-form/comment-form.stories.ts delete mode 100644 src/components/organisms/forms/comment-form/comment-form.stories.tsx (limited to 'src/components/organisms/forms/comment-form') diff --git a/src/components/organisms/forms/comment-form/comment-form.stories.ts b/src/components/organisms/forms/comment-form/comment-form.stories.ts new file mode 100644 index 0000000..0518f61 --- /dev/null +++ b/src/components/organisms/forms/comment-form/comment-form.stories.ts @@ -0,0 +1,23 @@ +import type { Meta, StoryObj } from '@storybook/react'; +import { CommentForm, type CommentFormSubmit } from './comment-form'; + +const meta = { + component: CommentForm, + title: 'Organisms/Forms/Comment', +} satisfies Meta; + +export default meta; + +type Story = StoryObj; + +const saveComment: CommentFormSubmit = () => { + console.log('Comment saved!'); + + return undefined; +}; + +export const Example: Story = { + args: { + onSubmit: saveComment, + }, +}; diff --git a/src/components/organisms/forms/comment-form/comment-form.stories.tsx b/src/components/organisms/forms/comment-form/comment-form.stories.tsx deleted file mode 100644 index fcc76fa..0000000 --- a/src/components/organisms/forms/comment-form/comment-form.stories.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import type { ComponentMeta, ComponentStory } from '@storybook/react'; -import { CommentForm as CommentFormComponent } from './comment-form'; - -/** - * CommentForm - Storybook Meta - */ -export default { - title: 'Organisms/Forms', - component: CommentFormComponent, - argTypes: { - parentId: { - control: { - type: null, - }, - description: 'The parent id if it is a reply.', - type: { - name: 'number', - required: false, - }, - }, - onSubmit: { - control: { - type: null, - }, - description: 'A callback function to process the comment form data.', - table: { - category: 'Events', - }, - type: { - name: 'function', - required: false, - }, - }, - }, -} as ComponentMeta; - -const Template: ComponentStory = (args) => ( - -); - -/** - * Forms Stories - Comment form - */ -export const CommentForm = Template.bind({}); -- cgit v1.2.3