From d5ade2359539648845a5854ed353b29367961d74 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Mon, 20 Nov 2023 11:02:20 +0100 Subject: refactor(components): extract MetaItem from MetaList * replace `items` prop on MetaList with `children` prop: it was too restrictive and the global options was not really useful. It is better too give control to the consumers. --- .../templates/page/page-layout.stories.tsx | 74 ++++++++++++---------- src/components/templates/page/page-layout.tsx | 15 ++--- 2 files changed, 46 insertions(+), 43 deletions(-) (limited to 'src/components/templates/page') diff --git a/src/components/templates/page/page-layout.stories.tsx b/src/components/templates/page/page-layout.stories.tsx index 2b44933..6dcbeea 100644 --- a/src/components/templates/page/page-layout.stories.tsx +++ b/src/components/templates/page/page-layout.stories.tsx @@ -1,5 +1,6 @@ import type { ComponentMeta, ComponentStory } from '@storybook/react'; import { ButtonLink, Heading, Link } from '../../atoms'; +import { MetaItem, MetaList } from '../../molecules'; import { LinksWidget, PostsList, SharingWidget } from '../../organisms'; import { LayoutBase } from '../layout/layout.stories'; import { PageLayout as PageLayoutComponent } from './page-layout'; @@ -270,38 +271,41 @@ Post.args = { breadcrumb: postBreadcrumb, title: pageTitle, intro: pageIntro, - headerMeta: [ - { id: 'publication-date', label: 'Published on:', value: '2020-03-14' }, - { - id: 'thematics', - label: 'Thematics:', - value: [ - { - id: 'cat-1', - value: ( - - Cat 1 - - ), - }, - { - id: 'cat-2', - value: ( - - Cat 2 - - ), - }, - ], - }, - ], - footerMeta: [ - { - id: 'read-more', - label: 'Read more about:', - value: Topic 1, - }, - ], + headerMeta: ( + + + + Cat 1 + + ), + }, + { + id: 'cat-2', + value: ( + + Cat 2 + + ), + }, + ]} + /> + + ), + footerMeta: ( + + Topic 1} + /> + + ), children: ( <> Impedit commodi rerum @@ -497,7 +501,11 @@ export const Blog = Template.bind({}); Blog.args = { breadcrumb: postsListBreadcrumb, title: 'Blog', - headerMeta: [{ id: 'total', label: 'Total:', value: `${posts.length}` }], + headerMeta: ( + + + + ), children: , widgets: [ = ({ {children} )} - {footerMeta?.length ? ( - + {footerMeta ? ( + {footerMeta} ) : null}