59 lines
2.0 KiB
TypeScript
59 lines
2.0 KiB
TypeScript
import clsx from "clsx";
|
|
import { useTranslation } from "react-i18next";
|
|
import { Link } from "react-router";
|
|
import RightIcon from "../icons/RightIcon";
|
|
import { HomeIcon } from "~/components/ui/icons/vendor";
|
|
|
|
interface MenuItem {
|
|
title: string;
|
|
routePath?: string;
|
|
}
|
|
|
|
interface Props {
|
|
menu: MenuItem[];
|
|
className?: string;
|
|
home?: string;
|
|
}
|
|
|
|
export default function BreadcrumbSimple({ menu = [], className = "", home = "" }: Props) {
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<nav className={clsx("not-prose flex truncate", className)} aria-label={t("components.breadcrumb.ariaLabel")}>
|
|
{/* Subframe Breadcrumbs layout: BreadcrumbsRoot "flex items-center gap-2" */}
|
|
<ol className="flex items-center gap-2">
|
|
{home && (
|
|
<li>
|
|
<div>
|
|
<Link to={home.length > 0 ? home : "/"} className="hover:text-text-neutral-tertiary text-gray-300">
|
|
<HomeIcon className="h-4 w-4 shrink-0" aria-hidden="true" />
|
|
<span className="sr-only">{t("shared.home")}</span>
|
|
</Link>
|
|
</div>
|
|
</li>
|
|
)}
|
|
{menu
|
|
.filter((f) => f.title)
|
|
.map((item, idx) => (
|
|
<li key={item.title}>
|
|
{/* Subframe Breadcrumbs layout: uniform gap-2, divider sized to 14px text */}
|
|
<div className="flex items-center gap-2">
|
|
{(idx > 0 || home) && <RightIcon className="text-text-neutral-tertiary h-3.5 w-3.5 shrink-0" />}
|
|
{item.routePath ? (
|
|
<Link
|
|
to={item.routePath}
|
|
className="hover:text-text-neutral-tertiary text-text-neutral-tertiary select-none text-sm leading-5 font-normal"
|
|
>
|
|
{item.title}
|
|
</Link>
|
|
) : (
|
|
<span className="text-text-neutral-tertiary select-none text-sm leading-5 font-normal">{item.title}</span>
|
|
)}
|
|
</div>
|
|
</li>
|
|
))}
|
|
</ol>
|
|
</nav>
|
|
);
|
|
}
|