Skip to content

Commit 86e40ff

Browse files
committed
refactor: update Breadcrumbs component to render current page as span
This commit updates the Breadcrumbs component to render the current page as a span instead of a link when the `isCurrentPage` prop is true. This change is necessary to align with the Chakra UI library's implementation, as documented in the source code. The `href` attribute will not be passed down to the child when rendering as a span.
1 parent 98b51a7 commit 86e40ff

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/Breadcrumbs/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ const Breadcrumbs = ({ slug, startDepth = 0, ...props }: BreadcrumbsProps) => {
7070
return (
7171
<BreadcrumbItem key={fullPath} isCurrentPage={isCurrentPage}>
7272
<BreadcrumbLink
73-
as={BaseLink}
73+
// If current page, render as span since the `href` will not be
74+
// passed down to the child
75+
// ref: https://github.com/chakra-ui/chakra-ui/blob/v2/packages/components/src/breadcrumb/breadcrumb-link.tsx#L32
76+
as={isCurrentPage ? "span" : BaseLink}
7477
href={fullPath}
75-
isPartiallyActive={isCurrentPage}
7678
textTransform="uppercase"
7779
>
7880
{text}

0 commit comments

Comments
 (0)