From 5f3799ee75b3ac5cffe726023d8e5df129b919dd Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Fri, 13 May 2022 19:29:41 +0200
Subject: chore: add Thematic page

---
 src/components/organisms/layout/posts-list.tsx | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'src/components/organisms/layout/posts-list.tsx')

diff --git a/src/components/organisms/layout/posts-list.tsx b/src/components/organisms/layout/posts-list.tsx
index 4d77d20..9dfe254 100644
--- a/src/components/organisms/layout/posts-list.tsx
+++ b/src/components/organisms/layout/posts-list.tsx
@@ -122,18 +122,20 @@ const PostsList: FC<PostsListProps> = ({
    * @returns {JSX.Element | JSX.Element[]} The posts list.
    */
   const getPosts = (): JSX.Element | JSX.Element[] => {
-    if (!byYear) return getList(posts);
+    const firstLevel = titleLevel || 2;
+    if (!byYear) return getList(posts, firstLevel);
 
     const postsPerYear = sortPostsByYear(posts);
     const years = Object.keys(postsPerYear).reverse();
+    const nextLevel = (firstLevel + 1) as HeadingLevel;
 
     return years.map((year) => {
       return (
         <section key={year} className={styles.section}>
-          <Heading level={2} className={styles.year}>
+          <Heading level={firstLevel} className={styles.year}>
             {year}
           </Heading>
-          {getList(postsPerYear[year], titleLevel)}
+          {getList(postsPerYear[year], nextLevel)}
         </section>
       );
     });
-- 
cgit v1.2.3

