From f4ffab2585bc6aedfc696c62f71d058a0eac0274 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Thu, 20 Jan 2022 22:48:30 +0100
Subject: chore: include projects inside breadcrumb

---
 src/components/Breadcrumb/Breadcrumb.tsx | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

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

diff --git a/src/components/Breadcrumb/Breadcrumb.tsx b/src/components/Breadcrumb/Breadcrumb.tsx
index 0b9977e..7c8eb5c 100644
--- a/src/components/Breadcrumb/Breadcrumb.tsx
+++ b/src/components/Breadcrumb/Breadcrumb.tsx
@@ -11,8 +11,9 @@ const Breadcrumb = ({ pageTitle }: { pageTitle: string }) => {
 
   const isHome = router.pathname === '/';
   const isArticle = router.pathname.includes('/article/');
-  const isThematic = router.pathname.includes('/thematique/');
+  const isProject = router.pathname.includes('/projet/');
   const isSubject = router.pathname.includes('/sujet/');
+  const isThematic = router.pathname.includes('/thematique/');
 
   const getItems = () => {
     return (
@@ -31,6 +32,15 @@ const Breadcrumb = ({ pageTitle }: { pageTitle: string }) => {
             </li>
           </>
         )}
+        {isProject && (
+          <>
+            <li className={styles.item}>
+              <Link href="/projets">
+                <a>{t`Projects`}</a>
+              </Link>
+            </li>
+          </>
+        )}
         <li className="screen-reader-text">{pageTitle}</li>
       </>
     );
@@ -58,6 +68,17 @@ const Breadcrumb = ({ pageTitle }: { pageTitle: string }) => {
       items.push(blog);
     }
 
+    if (isProject) {
+      const blog: BreadcrumbList['itemListElement'] = {
+        '@type': 'ListItem',
+        position: 2,
+        name: t`Projects`,
+        item: `${config.url}/projets`,
+      };
+
+      items.push(blog);
+    }
+
     const currentPage: BreadcrumbList['itemListElement'] = {
       '@type': 'ListItem',
       position: items.length + 1,
-- 
cgit v1.2.3

