ignore folder
This commit is contained in:
31
components/ui/Breadcrumb.tsx
Normal file
31
components/ui/Breadcrumb.tsx
Normal file
@ -0,0 +1,31 @@
|
||||
import Link from "next/link";
|
||||
|
||||
export type BreadcrumbItem = {
|
||||
label: string;
|
||||
href?: string;
|
||||
};
|
||||
|
||||
export default function Breadcrumb({ items }: { items: BreadcrumbItem[] }) {
|
||||
if (!items.length) return null;
|
||||
|
||||
return (
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol className="breadcrumb">
|
||||
{items.map((item, index) => (
|
||||
<li
|
||||
key={item.label + index}
|
||||
className={`breadcrumb-item ${index === items.length - 1 ? "active" : ""}`}
|
||||
>
|
||||
{index === items.length - 1 || !item.href ? (
|
||||
<span>{item.label}</span>
|
||||
) : (
|
||||
<Link href={item.href} className="text-decoration-none">
|
||||
{item.label}
|
||||
</Link>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user