Breadcrumbs.jsx
517 B · jsx · 17 lines
1import { Icon } from "./Icon.jsx";23export function Breadcrumbs({ trail }) {4 if (!trail.length) return null;5 return (6 <nav className="crumbs" aria-label="Breadcrumb">7 <ol>8 {trail.map((one, i) => (9 <li key={one.href ?? one.name}>10 {i ? <Icon name="chevron_right" extra="small" /> : null}11 {one.href && i < trail.length - 1 ? <a href={one.href}>{one.name}</a> : <span aria-current="page">{one.name}</span>}12 </li>13 ))}14 </ol>15 </nav>16 );17}