import { Fragment } from 'react'; import { Box, Flex, Text } from '@chakra-ui/react'; import RouterLink from '@/components/RouterLink'; import { t } from '@/i18n'; import type { BreadcrumbItem } from '@/lib/shootPageView'; type BreadcrumbProps = { // The name of the navigation landmark, e.g. "Kruimelpad" label: string; // The last item is the page itself items: readonly BreadcrumbItem[]; 'data-testid'?: string; }; // The path to the current page (BR-SP-01..04): links for every item but the // last, which is plain text marked as the current page. The links match // exactly, so only the page itself can ever be "current". export default function Breadcrumb({ label, items, 'data-testid': testId, }: BreadcrumbProps) { if (items.length === 0) return null; return ( {items.map((item, index) => { const last = index === items.length - 1; // The list is static, so the index is a stable key return ( {last ? ( {item.label} ) : ( {item.label} )} {!last && ( )} ); })} ); }