aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/widgets/toc-widget/toc-widget.stories.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-12-15 18:35:16 +0100
committerArmand Philippot <git@armandphilippot.com>2023-12-15 18:49:49 +0100
commit0f936ec0e7606cb79434d94096b6e113a7ce78eb (patch)
tree465ec7f66ac9459be6a18ac046e10357814c7b92 /src/components/organisms/widgets/toc-widget/toc-widget.stories.tsx
parent4e4d2eb25365be861e19f9756cf334ba2faa6911 (diff)
refactor(stories): migrate stories to CSF3 format
Diffstat (limited to 'src/components/organisms/widgets/toc-widget/toc-widget.stories.tsx')
-rw-r--r--src/components/organisms/widgets/toc-widget/toc-widget.stories.tsx63
1 files changed, 24 insertions, 39 deletions
diff --git a/src/components/organisms/widgets/toc-widget/toc-widget.stories.tsx b/src/components/organisms/widgets/toc-widget/toc-widget.stories.tsx
index 3563a94..003e787 100644
--- a/src/components/organisms/widgets/toc-widget/toc-widget.stories.tsx
+++ b/src/components/organisms/widgets/toc-widget/toc-widget.stories.tsx
@@ -1,46 +1,31 @@
-import type { ComponentMeta, ComponentStory } from '@storybook/react';
+import type { Meta, StoryObj } from '@storybook/react';
import { Heading } from '../../../atoms';
import { TocWidget } from './toc-widget';
-/**
- * TocWidget - Storybook Meta
- */
-export default {
- title: 'Organisms/Widgets/Table of Contents',
+const meta = {
component: TocWidget,
- argTypes: {
- tree: {
- description: 'The headings tree.',
- type: {
- name: 'object',
- required: true,
- value: {},
- },
- },
- },
-} as ComponentMeta<typeof TocWidget>;
+ title: 'Organisms/Widgets/Table of Contents',
+} satisfies Meta<typeof TocWidget>;
-const Template: ComponentStory<typeof TocWidget> = (args) => (
- <TocWidget {...args} />
-);
+export default meta;
-/**
- * Widgets Stories - Table of Contents
- */
-export const TableOfContents = Template.bind({});
-TableOfContents.args = {
- heading: <Heading level={3}>Table of contents</Heading>,
- tree: [
- { children: [], depth: 2, id: 'title1', label: 'Title 1' },
- {
- children: [
- { children: [], depth: 3, id: 'subtitle1', label: 'Subtitle 1' },
- { children: [], depth: 3, id: 'subtitle2', label: 'Subtitle 2' },
- ],
- depth: 2,
- id: 'title2',
- label: 'Title 2',
- },
- { children: [], depth: 2, id: 'title3', label: 'Title 3' },
- ],
+type Story = StoryObj<typeof meta>;
+
+export const TableOfContents: Story = {
+ args: {
+ heading: <Heading level={3}>Table of contents</Heading>,
+ tree: [
+ { children: [], depth: 2, id: 'title1', label: 'Title 1' },
+ {
+ children: [
+ { children: [], depth: 3, id: 'subtitle1', label: 'Subtitle 1' },
+ { children: [], depth: 3, id: 'subtitle2', label: 'Subtitle 2' },
+ ],
+ depth: 2,
+ id: 'title2',
+ label: 'Title 2',
+ },
+ { children: [], depth: 2, id: 'title3', label: 'Title 3' },
+ ],
+ },
};