update
This commit is contained in:
33
app/_components/Breadcrumb.tsx
Normal file
33
app/_components/Breadcrumb.tsx
Normal file
@ -0,0 +1,33 @@
|
||||
import { Fragment } from "react";
|
||||
import Link from "next/link";
|
||||
|
||||
export interface BreadcrumbItem {
|
||||
href: string;
|
||||
title: string;
|
||||
}
|
||||
|
||||
const Breadcrumb = ({ navigations }: { navigations: BreadcrumbItem[] }) => {
|
||||
return (
|
||||
<div className={"flex truncate text-xs text-[#13426e]"}>
|
||||
<span className={"mr-2"}>当前位置:</span>
|
||||
{navigations.map((navigation, index) => {
|
||||
if (index === navigations.length - 1) {
|
||||
return (
|
||||
<span className={"overflow-hidden truncate"} key={navigation.href}>
|
||||
{navigation.title}
|
||||
</span>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<Fragment key={navigation.href}>
|
||||
<Link href={navigation.href}>{navigation.title}</Link>
|
||||
<span className={"mx-2"}>/</span>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Breadcrumb;
|
Reference in New Issue
Block a user