aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/recherche
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-10-10 19:37:51 +0200
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:14:41 +0100
commitc87c615b5866b8a8f361eeb0764bfdea85740e90 (patch)
treec27bda05fd96bbe3154472e170ba1abd5f9ea499 /src/pages/recherche
parent15522ec9146f6f1956620355c44dea2a6a75b67c (diff)
refactor(components): replace Meta component with MetaList
It removes items complexity by allowing consumers to use any label/value association. Translations should also be defined by the consumer. Each item can now be configured separately (borders, layout...).
Diffstat (limited to 'src/pages/recherche')
-rw-r--r--src/pages/recherche/index.tsx25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/pages/recherche/index.tsx b/src/pages/recherche/index.tsx
index f47e40c..32312ec 100644
--- a/src/pages/recherche/index.tsx
+++ b/src/pages/recherche/index.tsx
@@ -9,6 +9,7 @@ import {
getLayout,
Heading,
LinksListWidget,
+ type MetaItemData,
Notice,
PageLayout,
PostsList,
@@ -133,6 +134,28 @@ 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 }
+ ),
+ },
+ ]
+ : [];
+
/**
* Load more posts handler.
*/
@@ -181,7 +204,7 @@ const SearchPage: NextPageWithLayout<SearchPageProps> = ({
title={title}
breadcrumb={breadcrumbItems}
breadcrumbSchema={breadcrumbSchema}
- headerMeta={{ total: totalArticles }}
+ headerMeta={headerMeta}
widgets={[
<LinksListWidget
heading={