summaryrefslogtreecommitdiffstats
path: root/src/components/PostHeader/PostHeader.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2021-12-20 00:15:20 +0100
committerArmand Philippot <git@armandphilippot.com>2021-12-20 00:15:20 +0100
commitfa6adedc42e9c6ec39cc30df16b54900c220b094 (patch)
tree6bb498beadaa382245cecb86ce56931580313c6f /src/components/PostHeader/PostHeader.tsx
parent2ff898626c5c0abc6b8195224067b992403e313b (diff)
refactor: rewrite types and services
I was repeating myself a lot in services. So I rewrited the different functions to improve readability and I extracted some formatting functions to put them in utils. I also rewrited/reorganized some types to keep consistent names.
Diffstat (limited to 'src/components/PostHeader/PostHeader.tsx')
-rw-r--r--src/components/PostHeader/PostHeader.tsx11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/components/PostHeader/PostHeader.tsx b/src/components/PostHeader/PostHeader.tsx
index 5c5aff4..3ee6705 100644
--- a/src/components/PostHeader/PostHeader.tsx
+++ b/src/components/PostHeader/PostHeader.tsx
@@ -1,5 +1,6 @@
import { t } from '@lingui/macro';
-import { ArticleAuthor, ArticleDates } from '@ts/types/articles';
+import { Dates } from '@ts/types/app';
+import { ArticleAuthor } from '@ts/types/articles';
import { ThematicPreview } from '@ts/types/taxonomies';
import Link from 'next/link';
import { useRouter } from 'next/router';
@@ -7,13 +8,13 @@ import styles from './PostHeader.module.scss';
const PostHeader = ({
author,
- date,
+ dates,
intro,
title,
thematics,
}: {
author: ArticleAuthor;
- date: ArticleDates;
+ dates: Dates;
intro: string;
title: string;
thematics: ThematicPreview[];
@@ -52,9 +53,9 @@ const PostHeader = ({
<h1>{title}</h1>
<ul className={styles.meta}>
<li>{t`Written by ${getAuthor()} on ${getLocaleDate(
- date.publication
+ dates.publication
)}.`}</li>
- <li>{t`Last update on ${getLocaleDate(date.update)}.`}</li>
+ <li>{t`Last update on ${getLocaleDate(dates.update)}.`}</li>
{thematics.length > 0 && (
<li>
<dl>