summaryrefslogtreecommitdiffstats
path: root/src/components/molecules
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-05-22 15:09:39 +0200
committerArmand Philippot <git@armandphilippot.com>2022-05-22 15:09:39 +0200
commit321dae4a47594af83269fa560b375965d7f35763 (patch)
tree28392e486bb8c99c231e767d1532935c5ebc1b94 /src/components/molecules
parent70bd37fe14d4e0c1538291fa97b0522ab6d20941 (diff)
fix: render all images unoptimized in Storybook
There is a bug with next/image and Storybook. I was manually adding `unoptimized` to images. Instead we can use a workaround by adding an extra config in Storybook `preview.js` file.
Diffstat (limited to 'src/components/molecules')
-rw-r--r--src/components/molecules/images/flipping-logo.stories.tsx3
-rw-r--r--src/components/molecules/images/responsive-image.stories.tsx57
-rw-r--r--src/components/molecules/layout/branding.stories.tsx5
-rw-r--r--src/components/molecules/layout/card.stories.tsx1
4 files changed, 52 insertions, 14 deletions
diff --git a/src/components/molecules/images/flipping-logo.stories.tsx b/src/components/molecules/images/flipping-logo.stories.tsx
index 40a4c49..9d09293 100644
--- a/src/components/molecules/images/flipping-logo.stories.tsx
+++ b/src/components/molecules/images/flipping-logo.stories.tsx
@@ -54,7 +54,6 @@ export default {
required: true,
},
},
- unoptimized: { table: { disable: true } },
},
} as ComponentMeta<typeof FlippingLogoComponent>;
@@ -70,6 +69,4 @@ FlippingLogo.args = {
altText: 'Website picture',
logoTitle: 'Website logo',
photo: 'http://placeimg.com/640/480',
- // @ts-ignore - Needed because of the placeholder image.
- unoptimized: true,
};
diff --git a/src/components/molecules/images/responsive-image.stories.tsx b/src/components/molecules/images/responsive-image.stories.tsx
index ca69d4f..4917cde 100644
--- a/src/components/molecules/images/responsive-image.stories.tsx
+++ b/src/components/molecules/images/responsive-image.stories.tsx
@@ -80,7 +80,6 @@ export default {
required: false,
},
},
- unoptimized: { table: { disable: true } },
width: {
control: {
type: 'number',
@@ -121,7 +120,18 @@ Default.args = {
src: 'http://placeimg.com/640/480/transport',
width: 640,
height: 480,
- unoptimized: true,
+};
+
+/**
+ * Responsive Image Stories - With borders
+ */
+export const WithBorders = Template.bind({});
+WithBorders.args = {
+ alt: 'An example',
+ src: 'http://placeimg.com/640/480/transport',
+ width: 640,
+ height: 480,
+ withBorders: true,
};
/**
@@ -133,11 +143,23 @@ WithLink.args = {
src: 'http://placeimg.com/640/480/transport',
width: 640,
height: 480,
- unoptimized: true,
target: '#',
};
/**
+ * Responsive Image Stories - With link and borders
+ */
+export const WithLinkAndBorders = Template.bind({});
+WithLinkAndBorders.args = {
+ alt: 'An example',
+ src: 'http://placeimg.com/640/480/transport',
+ width: 640,
+ height: 480,
+ target: '#',
+ withBorders: true,
+};
+
+/**
* Responsive Image Stories - With caption
*/
export const WithCaption = Template.bind({});
@@ -147,7 +169,19 @@ WithCaption.args = {
width: 640,
height: 480,
caption: 'Omnis nulla labore',
- unoptimized: true,
+};
+
+/**
+ * Responsive Image Stories - With caption and borders
+ */
+export const WithCaptionAndBorders = Template.bind({});
+WithCaptionAndBorders.args = {
+ alt: 'An example',
+ src: 'http://placeimg.com/640/480/transport',
+ width: 640,
+ height: 480,
+ caption: 'Omnis nulla labore',
+ withBorders: true,
};
/**
@@ -161,5 +195,18 @@ WithCaptionAndLink.args = {
height: 480,
caption: 'Omnis nulla labore',
target: '#',
- unoptimized: true,
+};
+
+/**
+ * Responsive Image Stories - With caption, link and borders
+ */
+export const WithCaptionLinkAndBorders = Template.bind({});
+WithCaptionLinkAndBorders.args = {
+ alt: 'An example',
+ src: 'http://placeimg.com/640/480/transport',
+ width: 640,
+ height: 480,
+ caption: 'Omnis nulla labore',
+ target: '#',
+ withBorders: true,
};
diff --git a/src/components/molecules/layout/branding.stories.tsx b/src/components/molecules/layout/branding.stories.tsx
index d2e0694..94bb166 100644
--- a/src/components/molecules/layout/branding.stories.tsx
+++ b/src/components/molecules/layout/branding.stories.tsx
@@ -56,7 +56,6 @@ export default {
required: true,
},
},
- unoptimized: { table: { disable: true } },
withLink: {
control: {
type: 'boolean',
@@ -85,8 +84,6 @@ export const Default = Template.bind({});
Default.args = {
title: 'Website title',
photo: 'http://placeimg.com/640/480',
- // @ts-ignore - Needed because of the placeholder image.
- unoptimized: true,
};
/**
@@ -97,6 +94,4 @@ WithBaseline.args = {
title: 'Website title',
baseline: 'Maiores corporis qui',
photo: 'http://placeimg.com/640/480',
- // @ts-ignore - Needed because of the placeholder image.
- unoptimized: true,
};
diff --git a/src/components/molecules/layout/card.stories.tsx b/src/components/molecules/layout/card.stories.tsx
index 2e99bbb..0ad42c0 100644
--- a/src/components/molecules/layout/card.stories.tsx
+++ b/src/components/molecules/layout/card.stories.tsx
@@ -113,7 +113,6 @@ const cover = {
height: 480,
src: 'http://placeimg.com/640/480',
width: 640,
- unoptimized: true,
};
const meta = {