[examples/github-backed-catalog] - improvements after issue #871 (#887)

This commit is contained in:
Luccas Mateus
2023-05-17 11:10:18 -03:00
committed by GitHub
parent ebcb93c996
commit 4e91e88f2b
18 changed files with 276 additions and 182 deletions

View File

@@ -1,20 +1,28 @@
import Link from "next/link";
import HomeIcon from "../icons/HomeIcon";
export default function Breadcrumbs({ links }: { links: { title: string, href?: string, target?: string }[] }) {
export default function Breadcrumbs({
links,
}: {
links: { title: string; href?: string; target?: string }[];
}) {
const current = links.at(-1);
return <div className="flex items-center uppercase font-black text-xs">
<Link className="flex items-center" href='/'><HomeIcon /></Link>
return (
<div className="flex items-center uppercase font-black text-xs">
<Link className="flex items-center" href="/">
<HomeIcon />
</Link>
{/* {links.length > 1 && links.slice(0, -1).map((link) => {
{/* {links.length > 1 && links.slice(0, -1).map((link) => {
return <>
<span className="mx-4">/</span>
<Link href={link.href}>{link.title}</Link>
</>
})} */}
<span className="mx-4">/</span>
<span>{current.title}</span>
</div >
}
<span className="mx-4">/</span>
<span>{current.title}</span>
</div>
);
}