From 15522ec9146f6f1956620355c44dea2a6a75b67c Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Mon, 9 Oct 2023 18:26:23 +0200 Subject: refactor(components): replace ResponsiveImage with Figure component The styles applied to ResponsiveImage are related to the figure and figcaption elements. Those elements could be use with other contents than images. So I extracted them in a Figure component. The ResponsiveImage component is no longer useful: the consumer should use the Image component from `next` and wrap it in a link if needed. --- src/components/atoms/figure/figure.stories.tsx | 74 ++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/components/atoms/figure/figure.stories.tsx (limited to 'src/components/atoms/figure/figure.stories.tsx') diff --git a/src/components/atoms/figure/figure.stories.tsx b/src/components/atoms/figure/figure.stories.tsx new file mode 100644 index 0000000..7763641 --- /dev/null +++ b/src/components/atoms/figure/figure.stories.tsx @@ -0,0 +1,74 @@ +import type { ComponentMeta, ComponentStory } from '@storybook/react'; +import NextImage from 'next/image'; +import { Figure } from './figure'; + +/** + * Figure - Storybook Meta + */ +export default { + title: 'Atoms/Figure', + component: Figure, + args: {}, + argTypes: { + caption: { + control: { + type: 'text', + }, + description: 'A figure caption.', + table: { + category: 'Options', + }, + type: { + name: 'string', + required: false, + }, + }, + hasBorders: { + control: { + type: 'boolean', + }, + description: 'Add borders around the figure.', + table: { + category: 'Styles', + defaultValue: { summary: false }, + }, + type: { + name: 'boolean', + required: false, + }, + }, + }, +} as ComponentMeta; + +const Template: ComponentStory = (args) =>
; + +/** + * Figure Stories - Illustration + */ +export const Illustration = Template.bind({}); +Illustration.args = { + children: ( + + ), +}; + +/** + * Figure Stories - BorderedIllustration + */ +export const BorderedIllustration = Template.bind({}); +BorderedIllustration.args = { + children: ( + + ), + hasBorders: true, +}; -- cgit v1.2.3