aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/widgets/image-widget/image-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/image-widget/image-widget.stories.tsx
parent4e4d2eb25365be861e19f9756cf334ba2faa6911 (diff)
refactor(stories): migrate stories to CSF3 format
Diffstat (limited to 'src/components/organisms/widgets/image-widget/image-widget.stories.tsx')
-rw-r--r--src/components/organisms/widgets/image-widget/image-widget.stories.tsx141
1 files changed, 47 insertions, 94 deletions
diff --git a/src/components/organisms/widgets/image-widget/image-widget.stories.tsx b/src/components/organisms/widgets/image-widget/image-widget.stories.tsx
index 33f3e7b..5f302e0 100644
--- a/src/components/organisms/widgets/image-widget/image-widget.stories.tsx
+++ b/src/components/organisms/widgets/image-widget/image-widget.stories.tsx
@@ -1,55 +1,16 @@
-import type { ComponentMeta, ComponentStory } from '@storybook/react';
+import type { Meta, StoryObj } from '@storybook/react';
import NextImage from 'next/image';
import { Heading } from '../../../atoms';
import { ImageWidget } from './image-widget';
-/**
- * ImageWidget - Storybook Meta
- */
-export default {
- title: 'Organisms/Widgets/Image',
+const meta = {
component: ImageWidget,
- argTypes: {
- description: {
- control: {
- type: 'text',
- },
- description: 'Add a caption image.',
- table: {
- category: 'Options',
- },
- type: {
- name: 'string',
- required: false,
- },
- },
- img: {
- description: 'The image.',
- type: {
- name: 'object',
- required: true,
- value: {},
- },
- },
- url: {
- control: {
- type: 'text',
- },
- description: 'Add a link to the image.',
- table: {
- category: 'Options',
- },
- type: {
- name: 'string',
- required: false,
- },
- },
- },
-} as ComponentMeta<typeof ImageWidget>;
+ title: 'Organisms/Widgets/Image',
+} satisfies Meta<typeof ImageWidget>;
+
+export default meta;
-const Template: ComponentStory<typeof ImageWidget> = (args) => (
- <ImageWidget {...args} />
-);
+type Story = StoryObj<typeof meta>;
const image = {
alt: '',
@@ -58,58 +19,50 @@ const image = {
width: 640,
};
-/**
- * ImageWidget Stories - Default
- */
-export const Default = Template.bind({});
-Default.args = {
- heading: (
- <Heading isFake level={3}>
- Quo et totam
- </Heading>
- ),
- img: <NextImage {...image} />,
+export const Example: Story = {
+ args: {
+ heading: (
+ <Heading isFake level={3}>
+ Quo et totam
+ </Heading>
+ ),
+ img: <NextImage {...image} />,
+ },
};
-/**
- * ImageWidget Stories - WithDescription
- */
-export const WithDescription = Template.bind({});
-WithDescription.args = {
- description: 'Any image used as an example',
- heading: (
- <Heading isFake level={3}>
- Quo et totam
- </Heading>
- ),
- img: <NextImage {...image} />,
+export const WithDescription: Story = {
+ args: {
+ description: 'Any image used as an example',
+ heading: (
+ <Heading isFake level={3}>
+ Quo et totam
+ </Heading>
+ ),
+ img: <NextImage {...image} />,
+ },
};
-/**
- * ImageWidget Stories - WithLink
- */
-export const WithLink = Template.bind({});
-WithLink.args = {
- heading: (
- <Heading isFake level={3}>
- Quo et totam
- </Heading>
- ),
- img: <NextImage {...image} />,
- url: 'https://www.armandphilippot.com/',
+export const WithLink: Story = {
+ args: {
+ heading: (
+ <Heading isFake level={3}>
+ Quo et totam
+ </Heading>
+ ),
+ img: <NextImage {...image} />,
+ url: 'https://www.armandphilippot.com/',
+ },
};
-/**
- * ImageWidget Stories - WithDescriptionAndLink
- */
-export const WithDescriptionAndLink = Template.bind({});
-WithDescriptionAndLink.args = {
- description: 'Any image used as an example',
- heading: (
- <Heading isFake level={3}>
- Quo et totam
- </Heading>
- ),
- img: <NextImage {...image} />,
- url: 'https://www.armandphilippot.com/',
+export const WithDescriptionAndLink: Story = {
+ args: {
+ description: 'Any image used as an example',
+ heading: (
+ <Heading isFake level={3}>
+ Quo et totam
+ </Heading>
+ ),
+ img: <NextImage {...image} />,
+ url: 'https://www.armandphilippot.com/',
+ },
};