diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-11-20 11:02:20 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-11-20 19:20:21 +0100 |
| commit | d5ade2359539648845a5854ed353b29367961d74 (patch) | |
| tree | 45a49d90090408887135a971a7fd79c45d9dcd94 /src/pages/recherche | |
| parent | 6ab9635a22d69186c8a24181ad5df7736e288577 (diff) | |
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.
Diffstat (limited to 'src/pages/recherche')
| -rw-r--r-- | src/pages/recherche/index.tsx | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/src/pages/recherche/index.tsx b/src/pages/recherche/index.tsx index 92035b0..0fb279b 100644 --- a/src/pages/recherche/index.tsx +++ b/src/pages/recherche/index.tsx @@ -9,13 +9,14 @@ import { getLayout, Heading, LinksWidget, - type MetaItemData, Notice, PageLayout, PostsList, Spinner, SearchForm, type SearchFormSubmit, + MetaList, + MetaItem, } from '../../components'; import { getArticles, @@ -132,28 +133,6 @@ const SearchPage: NextPageWithLayout<SearchPageProps> = ({ getTotalArticles(query.s as string) ); - const headerMeta: MetaItemData[] = totalArticles - ? [ - { - id: 'posts-count', - label: intl.formatMessage({ - defaultMessage: 'Total:', - description: 'Page: total label', - id: 'kNBXyK', - }), - value: intl.formatMessage( - { - defaultMessage: - '{postsCount, plural, =0 {No articles} one {# article} other {# articles}}', - description: 'Page: posts count meta', - id: 'RvGb2c', - }, - { postsCount: totalArticles } - ), - }, - ] - : []; - const thematicsListTitle = intl.formatMessage({ defaultMessage: 'Thematics', description: 'SearchPage: thematics list widget title', @@ -215,7 +194,27 @@ const SearchPage: NextPageWithLayout<SearchPageProps> = ({ title={title} breadcrumb={breadcrumbItems} breadcrumbSchema={breadcrumbSchema} - headerMeta={headerMeta} + headerMeta={ + <MetaList> + <MetaItem + isInline + label={intl.formatMessage({ + defaultMessage: 'Total:', + description: 'Page: total label', + id: 'kNBXyK', + })} + value={intl.formatMessage( + { + defaultMessage: + '{postsCount, plural, =0 {No articles} one {# article} other {# articles}}', + description: 'Page: posts count meta', + id: 'RvGb2c', + }, + { postsCount: totalArticles } + )} + /> + </MetaList> + } widgets={[ <LinksWidget heading={ |
