33 lines
701 B
TypeScript
33 lines
701 B
TypeScript
import type { ReactNode } from "react";
|
|
import {
|
|
Breadcrumb,
|
|
BreadcrumbItem,
|
|
BreadcrumbList,
|
|
BreadcrumbPage,
|
|
} from "@/components/ui/breadcrumb";
|
|
|
|
/** Current page segment shown in the header — pass a nav item or `{ title, icon? }`. */
|
|
export type AppBreadcrumbPage = {
|
|
title: string;
|
|
icon?: ReactNode;
|
|
};
|
|
|
|
export function AppBreadcrumbs({ page }: { page?: AppBreadcrumbPage | null }) {
|
|
if (!page?.title) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Breadcrumb>
|
|
<BreadcrumbList>
|
|
<BreadcrumbItem>
|
|
<BreadcrumbPage className="flex items-center gap-2 [&>svg]:size-3.5">
|
|
{page.icon}
|
|
{page.title}
|
|
</BreadcrumbPage>
|
|
</BreadcrumbItem>
|
|
</BreadcrumbList>
|
|
</Breadcrumb>
|
|
);
|
|
}
|