From c153f93dc8691a71dc76aad3dd618298da9d238a Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Tue, 17 Oct 2023 19:46:08 +0200 Subject: refactor(components): rewrite Card component * make the component more generic * merge `` and `` styles into card component to avoid repeating the same structure * remove most of the props to use composition However the CSS is a bit complex because of the two variants... Also, the component should be refactored when the CSS pseudo-class `:has` has enough support: the provider and the `cover` and `meta` props should be removed. --- src/components/organisms/layout/summary.tsx | 92 +++++++++++++++++------------ 1 file changed, 53 insertions(+), 39 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 4fe7632..0c95f90 100644 --- a/src/components/organisms/layout/summary.tsx +++ b/src/components/organisms/layout/summary.tsx @@ -3,16 +3,18 @@ import type { FC, ReactNode } from 'react'; import { useIntl } from 'react-intl'; import type { Article, Meta as MetaType } from '../../../types'; import { useReadingTime } from '../../../utils/hooks'; +import { ButtonLink, type HeadingLevel, Icon, Link, Time } from '../../atoms'; import { - ButtonLink, - Heading, - type HeadingLevel, - Icon, - Link, - Figure, - Time, -} from '../../atoms'; -import { MetaList, type MetaItemData } from '../../molecules'; + Card, + CardActions, + CardBody, + CardCover, + CardFooter, + CardHeader, + CardMeta, + CardTitle, + type MetaItemData, +} from '../../molecules'; import styles from './summary.module.scss'; export type Cover = Pick; @@ -56,6 +58,14 @@ export const Summary: FC = ({ url, }) => { const intl = useIntl(); + const figureLabel = intl.formatMessage( + { + defaultMessage: '{title} cover', + description: 'Summary: figure (cover) accessible name', + id: 'RNVe1W', + }, + { title } + ); const readMore = intl.formatMessage( { defaultMessage: 'Read more about {title}', @@ -182,40 +192,44 @@ export const Summary: FC = ({ }; return ( -
- {meta.cover ? ( -
- -
- ) : null} -
- - - {title} - - -
-
+ + + + ) : undefined + } + meta={} + > + + + {title} + + +
- - {readMore} - - -
-
- -
-
+ + + + + {readMore} + + + + + ); }; -- cgit v1.2.3