diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-05-16 19:40:23 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-05-16 19:40:23 +0200 |
| commit | c77c58e18143233be042c4980a6ed08ae9beac52 (patch) | |
| tree | 94f7d828571a86470ae299fff7dffd32fb38de7c /src/components/molecules/layout | |
| parent | 2155550fa36a3bc3c8f66e0926530123b4018cd4 (diff) | |
chore: adjust and complete missing styles
* add logo to topics pages and links
* add Prism styles to articles
* and a few other adjustements
Diffstat (limited to 'src/components/molecules/layout')
| -rw-r--r-- | src/components/molecules/layout/meta.tsx | 59 | ||||
| -rw-r--r-- | src/components/molecules/layout/page-footer.tsx | 4 | ||||
| -rw-r--r-- | src/components/molecules/layout/page-header.module.scss | 6 | ||||
| -rw-r--r-- | src/components/molecules/layout/page-header.tsx | 11 |
4 files changed, 59 insertions, 21 deletions
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<MetaProps> = ({ 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<MetaProps> = ({ { defaultMessage: '{commentsCount, plural, =0 {No comments} one {# comment} other {# comments}}<a11y> about {title}</a11y>', - id: '02rgLO', description: 'Meta: comments count', + id: '02rgLO', }, { a11y: (chunks: ReactNode) => ( @@ -316,6 +326,23 @@ const Meta: FC<MetaProps> = ({ 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 ( + <Link href={url} external={true}> + {url} + </Link> + ); 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<PageFooterProps> = ({ meta, ...props }) => { return ( - <footer {...props}>{meta && <Meta data={meta} layout="column" />}</footer> + <footer {...props}> + {meta && <Meta data={meta} withSeparator={false} />} + </footer> ); }; 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<PageHeaderProps> = ({ }) => { const getIntro = () => { return typeof intro === 'string' ? ( - <div dangerouslySetInnerHTML={{ __html: intro }} /> + <div + className={styles.intro} + dangerouslySetInnerHTML={{ __html: intro }} + /> ) : ( - <div>{intro}</div> + <div className={styles.intro}>{intro}</div> ); }; |
