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/templates/page/page-comments.stories.tsx | |
| parent | 4e4d2eb25365be861e19f9756cf334ba2faa6911 (diff) | |
refactor(stories): migrate stories to CSF3 format
Diffstat (limited to 'src/components/templates/page/page-comments.stories.tsx')
| -rw-r--r-- | src/components/templates/page/page-comments.stories.tsx | 96 |
1 files changed, 36 insertions, 60 deletions
diff --git a/src/components/templates/page/page-comments.stories.tsx b/src/components/templates/page/page-comments.stories.tsx index 362f0a4..ba73747 100644 --- a/src/components/templates/page/page-comments.stories.tsx +++ b/src/components/templates/page/page-comments.stories.tsx @@ -1,45 +1,27 @@ -import type { ComponentMeta, ComponentStory } from '@storybook/react'; -import type { CommentData } from '../../organisms/comments-list'; +import type { Meta, StoryObj } from '@storybook/react'; +import type { CommentData } from '../../organisms'; import { Page } from './page'; -import { PageComments } from './page-comments'; +import { PageComments, type PageCommentsProps } from './page-comments'; -/** - * PageComments - Storybook Meta - */ -export default { - title: 'Templates/Page/Comments Section', - component: PageComments, - argTypes: { - comments: { - control: { - type: null, - }, - description: 'An array of comments.', - type: { - name: 'object', - required: true, - value: {}, - }, - }, - pageId: { - control: { - type: 'number', - }, - description: 'Define the page id in the database.', - type: { - name: 'number', - required: true, - }, - }, - }, -} as ComponentMeta<typeof PageComments>; - -const Template: ComponentStory<typeof PageComments> = (args) => ( +const WrappedPageComments = (props: PageCommentsProps) => ( <Page> - <PageComments {...args} /> + <PageComments {...props} /> </Page> ); +const meta = { + component: PageComments, + title: 'Templates/Page/PageComments', + render: WrappedPageComments, + parameters: { + layout: 'fullscreen', + }, +} satisfies Meta<typeof PageComments>; + +export default meta; + +type Story = StoryObj<typeof meta>; + const comments = [ { author: { @@ -139,32 +121,26 @@ const comments = [ }, ] satisfies CommentData[]; -/** - * PageComments Stories - Without comments - */ -export const WithoutComments = Template.bind({}); -WithoutComments.args = { - comments: [], - pageId: 1, +export const WithoutComments: Story = { + args: { + comments: [], + pageId: 1, + }, }; -/** - * PageComments Stories - With comments - */ -export const WithComments = Template.bind({}); -WithComments.args = { - comments, - depth: 2, - pageId: 1, +export const WithComments: Story = { + args: { + comments, + depth: 2, + pageId: 1, + }, }; -/** - * PageComments Stories - With comments closed - */ -export const WithCommentsClosed = Template.bind({}); -WithCommentsClosed.args = { - areCommentsClosed: true, - comments, - depth: 2, - pageId: 1, +export const WithCommentsClosed: Story = { + args: { + areCommentsClosed: true, + comments, + depth: 2, + pageId: 1, + }, }; |
