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/organisms/layout/summary.tsx | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/components/organisms/layout/summary.tsx') diff --git a/src/components/organisms/layout/summary.tsx b/src/components/organisms/layout/summary.tsx index e21e4c7..fa3dfe5 100644 --- a/src/components/organisms/layout/summary.tsx +++ b/src/components/organisms/layout/summary.tsx @@ -1,3 +1,4 @@ +import NextImage, { type ImageProps as NextImageProps } from 'next/image'; import type { FC, ReactNode } from 'react'; import { useIntl } from 'react-intl'; import type { Article, Meta as MetaType } from '../../../types'; @@ -8,19 +9,12 @@ import { type HeadingLevel, Icon, Link, + Figure, } from '../../atoms'; -import { - Meta, - type MetaData, - ResponsiveImage, - type ResponsiveImageProps, -} from '../../molecules'; +import { Meta, type MetaData } from '../../molecules'; import styles from './summary.module.scss'; -export type Cover = Pick< - ResponsiveImageProps, - 'alt' | 'src' | 'width' | 'height' ->; +export type Cover = Pick; export type SummaryMeta = Pick< MetaType<'article'>, @@ -108,7 +102,11 @@ export const Summary: FC = ({ return (
- {cover ? : null} + {cover ? ( +
+ +
+ ) : null}
-- cgit v1.2.3