update docs page breadcrumb
Took 5 minutes
This commit is contained in:
parent
71c24bd6cc
commit
40b799e280
@ -5,5 +5,5 @@ summary: 'petentium usu tota noluisse errem elaboraret auctor.'
|
|||||||
order: 2
|
order: 2
|
||||||
---
|
---
|
||||||
|
|
||||||
# Components
|
# 🧩 Components
|
||||||
...
|
...
|
@ -47,18 +47,15 @@ const DocsPage = async ({
|
|||||||
{/* Breadcrumb */}
|
{/* Breadcrumb */}
|
||||||
<Breadcrumb className="pt-4 pb-3 select-none">
|
<Breadcrumb className="pt-4 pb-3 select-none">
|
||||||
<BreadcrumbList>
|
<BreadcrumbList>
|
||||||
{splitSlug.map(
|
{splitSlug
|
||||||
(part: string, index: number): ReactElement => {
|
.slice(0, -1)
|
||||||
const active: boolean =
|
.map((part: string, index: number): ReactElement => {
|
||||||
index === splitSlug.length - 1;
|
|
||||||
const slug: string = splitSlug
|
const slug: string = splitSlug
|
||||||
.slice(1, index + 1)
|
.slice(1, index + 2) // Include one more to account for the index shift
|
||||||
.join("/");
|
.join("/");
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center" key={part}>
|
<div className="flex items-center" key={part}>
|
||||||
<BreadcrumbItem
|
<BreadcrumbItem>
|
||||||
className={cn(active && "text-primary")}
|
|
||||||
>
|
|
||||||
<BreadcrumbLink
|
<BreadcrumbLink
|
||||||
href={slug}
|
href={slug}
|
||||||
draggable={false}
|
draggable={false}
|
||||||
@ -66,13 +63,17 @@ const DocsPage = async ({
|
|||||||
{capitalizeWords(part)}
|
{capitalizeWords(part)}
|
||||||
</BreadcrumbLink>
|
</BreadcrumbLink>
|
||||||
</BreadcrumbItem>
|
</BreadcrumbItem>
|
||||||
{index < splitSlug.length - 1 && (
|
{index < splitSlug.length - 1 && ( // Adjusted to avoid separator after the last breadcrumb
|
||||||
<BreadcrumbSeparator className="pl-1.5" />
|
<BreadcrumbSeparator className="pl-1.5" />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
})}
|
||||||
)}
|
<BreadcrumbItem className="text-primary">
|
||||||
|
<BreadcrumbLink href="#" draggable={false}>
|
||||||
|
{page.title}{" "}
|
||||||
|
</BreadcrumbLink>
|
||||||
|
</BreadcrumbItem>
|
||||||
</BreadcrumbList>
|
</BreadcrumbList>
|
||||||
</Breadcrumb>
|
</Breadcrumb>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user