From c77c58e18143233be042c4980a6ed08ae9beac52 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Mon, 16 May 2022 19:40:23 +0200 Subject: chore: adjust and complete missing styles * add logo to topics pages and links * add Prism styles to articles * and a few other adjustements --- src/components/molecules/layout/meta.tsx | 59 ++++++++++++++++------ src/components/molecules/layout/page-footer.tsx | 4 +- .../molecules/layout/page-header.module.scss | 6 +++ src/components/molecules/layout/page-header.tsx | 11 ++-- 4 files changed, 59 insertions(+), 21 deletions(-) (limited to 'src/components/molecules/layout') diff --git a/src/components/molecules/layout/meta.tsx b/src/components/molecules/layout/meta.tsx index 1f6219a..74bd4ff 100644 --- a/src/components/molecules/layout/meta.tsx +++ b/src/components/molecules/layout/meta.tsx @@ -92,13 +92,17 @@ export type MetaData = { */ topics?: string[] | JSX.Element[]; /** - * A total. + * A total number of posts. */ - total?: string; + total?: number; /** * The update date. */ update?: MetaDate; + /** + * An url. + */ + website?: string; }; export type MetaKey = keyof MetaData; @@ -145,80 +149,86 @@ const Meta: FC = ({ case 'author': return intl.formatMessage({ defaultMessage: 'Written by:', - id: 'OI0N37', description: 'Meta: author label', + id: 'OI0N37', }); case 'comments': return intl.formatMessage({ defaultMessage: 'Comments:', - id: 'jTVIh8', description: 'Meta: comments label', + id: 'jTVIh8', }); case 'creation': return intl.formatMessage({ defaultMessage: 'Created on:', - id: 'b4fdYE', description: 'Meta: creation date label', + id: 'b4fdYE', }); case 'license': return intl.formatMessage({ defaultMessage: 'License:', - id: 'AuGklx', description: 'Meta: license label', + id: 'AuGklx', }); case 'popularity': return intl.formatMessage({ defaultMessage: 'Popularity:', - id: 'pWTj2W', description: 'Meta: popularity label', + id: 'pWTj2W', }); case 'publication': return intl.formatMessage({ defaultMessage: 'Published on:', - id: 'QGi5uD', description: 'Meta: publication date label', + id: 'QGi5uD', }); case 'readingTime': return intl.formatMessage({ defaultMessage: 'Reading time:', - id: 'EbFvsM', description: 'Meta: reading time label', + id: 'EbFvsM', }); case 'repositories': return intl.formatMessage({ defaultMessage: 'Repositories:', - id: 'DssFG1', description: 'Meta: repositories label', + id: 'DssFG1', }); case 'technologies': return intl.formatMessage({ defaultMessage: 'Technologies:', - id: 'ADQmDF', description: 'Meta: technologies label', + id: 'ADQmDF', }); case 'thematics': return intl.formatMessage({ defaultMessage: 'Thematics:', - id: 'bz53Us', description: 'Meta: thematics label', + id: 'bz53Us', }); case 'topics': return intl.formatMessage({ defaultMessage: 'Topics:', - id: 'gJNaBD', description: 'Meta: topics label', + id: 'gJNaBD', }); case 'total': return intl.formatMessage({ defaultMessage: 'Total:', - id: '92zgdp', description: 'Meta: total label', + id: '92zgdp', }); case 'update': return intl.formatMessage({ defaultMessage: 'Updated on:', - id: 'tLC7bh', description: 'Meta: update date label', + id: 'tLC7bh', + }); + case 'website': + return intl.formatMessage({ + defaultMessage: 'Official website:', + description: 'Meta: official website label', + id: 'GRyyfy', }); default: return ''; @@ -279,8 +289,8 @@ const Meta: FC = ({ { defaultMessage: '{commentsCount, plural, =0 {No comments} one {# comment} other {# comments}} about {title}', - id: '02rgLO', description: 'Meta: comments count', + id: '02rgLO', }, { a11y: (chunks: ReactNode) => ( @@ -316,6 +326,23 @@ const Meta: FC = ({ case 'publication': case 'update': return getDate(value as MetaDate); + case 'total': + return intl.formatMessage( + { + defaultMessage: + '{postsCount, plural, =0 {No articles} one {# article} other {# articles}}', + description: 'BlogPage: posts count meta', + id: 'OF5cPz', + }, + { postsCount: value as number } + ); + case 'website': + const url = value as string; + return ( + + {url} + + ); default: return value as string | ReactNode | ReactNode[]; } diff --git a/src/components/molecules/layout/page-footer.tsx b/src/components/molecules/layout/page-footer.tsx index e998b1e..97e449f 100644 --- a/src/components/molecules/layout/page-footer.tsx +++ b/src/components/molecules/layout/page-footer.tsx @@ -19,7 +19,9 @@ export type PageFooterProps = { */ const PageFooter: FC = ({ meta, ...props }) => { return ( -
{meta && }
+
+ {meta && } +
); }; diff --git a/src/components/molecules/layout/page-header.module.scss b/src/components/molecules/layout/page-header.module.scss index 4c7df5f..232023a 100644 --- a/src/components/molecules/layout/page-header.module.scss +++ b/src/components/molecules/layout/page-header.module.scss @@ -56,3 +56,9 @@ .meta { font-size: var(--font-size-sm); } + +.intro { + > *:last-child { + margin-bottom: 0; + } +} diff --git a/src/components/molecules/layout/page-header.tsx b/src/components/molecules/layout/page-header.tsx index 9abe9af..6759c7f 100644 --- a/src/components/molecules/layout/page-header.tsx +++ b/src/components/molecules/layout/page-header.tsx @@ -1,5 +1,5 @@ import Heading from '@components/atoms/headings/heading'; -import { FC } from 'react'; +import { FC, ReactNode } from 'react'; import Meta, { type MetaData } from './meta'; import styles from './page-header.module.scss'; @@ -19,7 +19,7 @@ export type PageHeaderProps = { /** * The page title. */ - title: string; + title: ReactNode; }; /** @@ -35,9 +35,12 @@ const PageHeader: FC = ({ }) => { const getIntro = () => { return typeof intro === 'string' ? ( -
+
) : ( -
{intro}
+
{intro}
); }; -- cgit v1.2.3