Files
UTMS-NG-FE/components/ui/Breadcrumb.tsx
2026-04-21 06:30:48 +07:00

32 lines
791 B
TypeScript

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>
);
}