diff options
Diffstat (limited to 'src/components/PostFooter/PostFooter.tsx')
| -rw-r--r-- | src/components/PostFooter/PostFooter.tsx | 35 |
1 files changed, 35 insertions, 0 deletions
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; |
