From 37bc9d25deecb04b7970881d46551d5b33fe88df Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Fri, 17 Dec 2021 19:21:11 +0100
Subject: chore: add meta to single posts

---
 src/components/PostFooter/PostFooter.tsx | 35 ++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 src/components/PostFooter/PostFooter.tsx

(limited to 'src/components/PostFooter/PostFooter.tsx')

diff --git a/src/components/PostFooter/PostFooter.tsx b/src/components/PostFooter/PostFooter.tsx
new file mode 100644
index 0000000..8c09d69
--- /dev/null
+++ b/src/components/PostFooter/PostFooter.tsx
@@ -0,0 +1,35 @@
+import { t } from '@lingui/macro';
+import { SubjectPreview } from '@ts/types/taxonomies';
+import Link from 'next/link';
+import styles from './PostFooter.module.scss';
+
+const PostFooter = ({ subjects }: { subjects: SubjectPreview[] }) => {
+  const getSubjects = () => {
+    return subjects.map((subject) => {
+      return (
+        <li key={subject.id}>
+          <Link href={`/sujet/${subject.slug}`}>
+            <a>{subject.title}</a>
+          </Link>
+        </li>
+      );
+    });
+  };
+
+  return (
+    <footer>
+      {subjects.length > 0 && (
+        <>
+          <dl className={styles.meta}>
+            <dt>{t`Subjects:`}</dt>
+            <dd>
+              <ul className={styles.list}>{getSubjects()}</ul>
+            </dd>
+          </dl>
+        </>
+      )}
+    </footer>
+  );
+};
+
+export default PostFooter;
-- 
cgit v1.2.3

