From 85c4c42bd601270d7be0f34a0767a34bb85e29bb Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Tue, 12 Dec 2023 18:50:03 +0100
Subject: refactor(hooks): rewrite useBreadcrumbs hook

* use next/router to get the slug instead of using props
* handle cases where the current page title is not provided
* update JSON-LD schema to match the example in documentation
* add tests
---
 src/components/organisms/nav/breadcrumbs/breadcrumbs.tsx | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'src/components/organisms/nav/breadcrumbs/breadcrumbs.tsx')

diff --git a/src/components/organisms/nav/breadcrumbs/breadcrumbs.tsx b/src/components/organisms/nav/breadcrumbs/breadcrumbs.tsx
index b6d3843..13434e1 100644
--- a/src/components/organisms/nav/breadcrumbs/breadcrumbs.tsx
+++ b/src/components/organisms/nav/breadcrumbs/breadcrumbs.tsx
@@ -9,13 +9,13 @@ export type BreadcrumbsItem = {
    */
   id: string;
   /**
-   * The item URL.
+   * The item label.
    */
-  url: string;
+  label: string;
   /**
-   * The item name.
+   * The item slug.
    */
-  name: string;
+  slug: string;
 };
 
 export type BreadcrumbsProps = Omit<NavProps, 'children'> & {
@@ -46,10 +46,10 @@ const BreadcrumbsWithRef: ForwardRefRenderFunction<
           return (
             <NavItem key={item.id}>
               {isLastItem ? (
-                <VisuallyHidden>{item.name}</VisuallyHidden>
+                <VisuallyHidden>{item.label}</VisuallyHidden>
               ) : (
                 <>
-                  <NavLink href={item.url} label={item.name} />
+                  <NavLink href={item.slug} label={item.label} />
                   <span aria-hidden className={styles.sep}>
                     {sep}
                   </span>
-- 
cgit v1.2.3

