From 0fa8ae55c52852c34c9143a6ec43c954c6404df1 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 15 Dec 2021 12:16:34 +0100 Subject: chore: retrieve posts list on blog page --- src/components/PostsList/PostsList.module.scss | 5 ++++ src/components/PostsList/PostsList.tsx | 36 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/components/PostsList/PostsList.module.scss create mode 100644 src/components/PostsList/PostsList.tsx (limited to 'src/components/PostsList') diff --git a/src/components/PostsList/PostsList.module.scss b/src/components/PostsList/PostsList.module.scss new file mode 100644 index 0000000..9f78f68 --- /dev/null +++ b/src/components/PostsList/PostsList.module.scss @@ -0,0 +1,5 @@ +@use "@styles/abstracts/placeholders"; + +.wrapper { + @extend %reset-ordered-list; +} diff --git a/src/components/PostsList/PostsList.tsx b/src/components/PostsList/PostsList.tsx new file mode 100644 index 0000000..ca3e788 --- /dev/null +++ b/src/components/PostsList/PostsList.tsx @@ -0,0 +1,36 @@ +import Link from 'next/link'; +import { ArticlePreview } from '@ts/types/articles'; +import styles from './PostsList.module.scss'; + +type TitleLevel = 2 | 3 | 4 | 5 | 6; + +const PostsList = ({ + posts, + titleLevel, +}: { + posts: ArticlePreview[]; + titleLevel: TitleLevel; +}) => { + const TitleTag = `h${titleLevel}` as keyof JSX.IntrinsicElements; + + const postsList = posts.map((post) => { + return ( +
  • + +
  • + ); + }); + + return
      {postsList}
    ; +}; + +export default PostsList; -- cgit v1.2.3