From c87c615b5866b8a8f361eeb0764bfdea85740e90 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Tue, 10 Oct 2023 19:37:51 +0200 Subject: 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...). --- src/pages/blog/page/[number].tsx | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/pages/blog/page/[number].tsx') diff --git a/src/pages/blog/page/[number].tsx b/src/pages/blog/page/[number].tsx index 15d7245..58cf7b9 100644 --- a/src/pages/blog/page/[number].tsx +++ b/src/pages/blog/page/[number].tsx @@ -9,6 +9,7 @@ import { getLayout, Heading, LinksListWidget, + type MetaItemData, PageLayout, PostsList, } from '../../../components'; @@ -132,6 +133,28 @@ const BlogPage: NextPageWithLayout = ({ }); const postsListBaseUrl = `${ROUTES.BLOG}/page/`; + 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 } + ), + }, + ] + : []; + return ( <> @@ -155,7 +178,7 @@ const BlogPage: NextPageWithLayout = ({ title={pageTitleWithPageNumber} breadcrumb={breadcrumbItems} breadcrumbSchema={breadcrumbSchema} - headerMeta={{ total: totalArticles }} + headerMeta={headerMeta} widgets={[ stats
blob: e5b5e536eec323c4560b5c7cfdeacb6e295d5f6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
!(function (e) {
  var t = { pattern: /^[;#].*/m, greedy: !0 },
    n = '"(?:[^\r\n"\\\\]|\\\\(?:[^\r]|\r\n?))*"(?!\\S)';
  Prism.languages.systemd = {
    comment: t,
    section: {
      pattern: /^\[[^\n\r\[\]]*\](?=[ \t]*$)/m,
      greedy: !0,
      inside: {
        punctuation: /^\[|\]$/,
        'section-name': { pattern: /[\s\S]+/, alias: 'selector' },
      },
    },
    key: { pattern: /^[^\s=]+(?=[ \t]*=)/m, greedy: !0, alias: 'attr-name' },
    value: {
      pattern: RegExp(
        '(=[ \t]*(?!\\s))(?:' +
          n +
          '|(?=[^"\r\n]))(?:[^\\s\\\\]|[ \t]+(?:(?![ \t"])|' +
          n +
          ')|\\\\[\r\n]+(?:[#;].*[\r\n]+)*(?![#;]))*'
      ),
      lookbehind: !0,
      greedy: !0,
      alias: 'attr-value',
      inside: {
        comment: t,
        quoted: { pattern: RegExp('(^|\\s)' + n), lookbehind: !0, greedy: !0 },
        punctuation: /\\$/m,
        boolean: { pattern: /^(?:false|no|off|on|true|yes)$/, greedy: !0 },
      },
    },
    operator: /=/,
  };
})();