Skip to content

Commit 16beaa7

Browse files
fix: convert incorrect breadcrumb links to opaque spans (#7626)
* fix: convert incorrect breadcrumb links to opaque spans * add linkless story * make sure last item is always displayed as active
1 parent 10a07a1 commit 16beaa7

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

packages/ui-components/Common/Breadcrumbs/index.stories.tsx

+19
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@ export const Default: Story = {
2424
},
2525
};
2626

27+
export const Linkless: Story = {
28+
args: {
29+
links: [
30+
{
31+
label: 'Learn',
32+
href: '',
33+
},
34+
{
35+
label: 'Getting Started',
36+
href: '',
37+
},
38+
{
39+
label: 'Introduction to Node.js',
40+
href: '',
41+
},
42+
],
43+
},
44+
};
45+
2746
export const Truncate: Story = {
2847
args: {
2948
links: [

packages/ui-components/Common/Breadcrumbs/index.tsx

+11-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,17 @@ const Breadcrumbs: FC<BreadcrumbsProps> = ({
5151
hideSeparator={isLastItem}
5252
position={position + +!hideHome}
5353
>
54-
<BreadcrumbLink as={as} href={link.href} active={isLastItem}>
55-
{link.label}
56-
</BreadcrumbLink>
54+
{link.href || isLastItem ? (
55+
<BreadcrumbLink
56+
as={as}
57+
href={link.href || undefined}
58+
active={isLastItem}
59+
>
60+
{link.label}
61+
</BreadcrumbLink>
62+
) : (
63+
<span className="opacity-70">{link.label}</span>
64+
)}
5765
</BreadcrumbItem>
5866
);
5967
}),

0 commit comments

Comments
 (0)