mirror of
https://github.com/perfect-panel/ppanel-admin-web.git
synced 2026-06-03 08:49:22 +08:00
41 lines
1014 B
TypeScript
41 lines
1014 B
TypeScript
'use client';
|
|
|
|
import { useTranslations } from 'next-intl';
|
|
import { Fragment } from 'react';
|
|
|
|
import {
|
|
Breadcrumb,
|
|
BreadcrumbItem,
|
|
BreadcrumbLink,
|
|
BreadcrumbList,
|
|
BreadcrumbPage,
|
|
BreadcrumbSeparator,
|
|
} from '@/components/ui/breadcrumb';
|
|
|
|
type BreadcrumbItemProperties = {
|
|
href: string;
|
|
label: string;
|
|
};
|
|
|
|
export function Breadcrumbs({ items }: { items: BreadcrumbItemProperties[] }) {
|
|
const t = useTranslations('menu');
|
|
|
|
return (
|
|
<Breadcrumb>
|
|
<BreadcrumbList>
|
|
{items.map((item, index) => (
|
|
<Fragment key={item.label}>
|
|
{index !== items.length - 1 && (
|
|
<BreadcrumbItem>
|
|
<BreadcrumbLink href={item.href}>{t(item.label)}</BreadcrumbLink>
|
|
</BreadcrumbItem>
|
|
)}
|
|
{index < items.length - 1 && <BreadcrumbSeparator />}
|
|
{index === items.length - 1 && <BreadcrumbPage>{t(item.label)}</BreadcrumbPage>}
|
|
</Fragment>
|
|
))}
|
|
</BreadcrumbList>
|
|
</Breadcrumb>
|
|
);
|
|
}
|