Add ZXDB breadcrumbs on list/detail pages and group release magazine references by issue for clearer Places view. Signed-off-by: codex@lucy.xalior.com
28 lines
748 B
TypeScript
28 lines
748 B
TypeScript
import Link from "next/link";
|
|
|
|
type Crumb = {
|
|
label: string;
|
|
href?: string;
|
|
};
|
|
|
|
export default function ZxdbBreadcrumbs({ items }: { items: Crumb[] }) {
|
|
if (items.length === 0) return null;
|
|
|
|
const lastIndex = items.length - 1;
|
|
|
|
return (
|
|
<nav aria-label="breadcrumb">
|
|
<ol className="breadcrumb">
|
|
{items.map((item, index) => {
|
|
const isActive = index === lastIndex || !item.href;
|
|
return (
|
|
<li key={`${item.label}-${index}`} className={`breadcrumb-item${isActive ? " active" : ""}`} aria-current={isActive ? "page" : undefined}>
|
|
{isActive ? item.label : <Link href={item.href ?? "#"}>{item.label}</Link>}
|
|
</li>
|
|
);
|
|
})}
|
|
</ol>
|
|
</nav>
|
|
);
|
|
}
|