From e331106e56d59a8b987230860b66214139c12ef6 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Mon, 13 Nov 2023 18:46:31 +0100 Subject: refactor(components): rewrite ImageWidget component * remove `imageClassName` prop * replace `image` prop with `img` and expect an image instead of an object * remove `alignment prop` * remove useless CSS --- .../widgets/image-widget/image-widget.stories.tsx | 115 +++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 src/components/organisms/widgets/image-widget/image-widget.stories.tsx (limited to 'src/components/organisms/widgets/image-widget/image-widget.stories.tsx') diff --git a/src/components/organisms/widgets/image-widget/image-widget.stories.tsx b/src/components/organisms/widgets/image-widget/image-widget.stories.tsx new file mode 100644 index 0000000..33f3e7b --- /dev/null +++ b/src/components/organisms/widgets/image-widget/image-widget.stories.tsx @@ -0,0 +1,115 @@ +import type { ComponentMeta, ComponentStory } 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', + 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; + +const Template: ComponentStory = (args) => ( + +); + +const image = { + alt: '', + height: 480, + src: 'https://picsum.photos/640/480', + width: 640, +}; + +/** + * ImageWidget Stories - Default + */ +export const Default = Template.bind({}); +Default.args = { + heading: ( + + Quo et totam + + ), + img: , +}; + +/** + * ImageWidget Stories - WithDescription + */ +export const WithDescription = Template.bind({}); +WithDescription.args = { + description: 'Any image used as an example', + heading: ( + + Quo et totam + + ), + img: , +}; + +/** + * ImageWidget Stories - WithLink + */ +export const WithLink = Template.bind({}); +WithLink.args = { + heading: ( + + Quo et totam + + ), + img: , + url: 'https://www.armandphilippot.com/', +}; + +/** + * ImageWidget Stories - WithDescriptionAndLink + */ +export const WithDescriptionAndLink = Template.bind({}); +WithDescriptionAndLink.args = { + description: 'Any image used as an example', + heading: ( + + Quo et totam + + ), + img: , + url: 'https://www.armandphilippot.com/', +}; -- cgit v1.2.3