All files / shared / components Breadcrumb.tsx

65% Statements 13/20
65% Branches 13/20
66.66% Functions 4/6
72.22% Lines 13/18

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 3255x     50x         160x                                              
interface BreadcrumbItem {
  label: string
  href?: string
}
 
interface BreadcrumbProps {
  items: BreadcrumbItem[]
}
 
export function Breadcrumb({ items }: BreadcrumbProps) {
  return (
    <nav aria-label="Breadcrumb" className="mb-4 text-sm text-muted-foreground">
      <ol className="flex items-center gap-2">
        {items.map((item, i) => (
          <li key={i} className="flex items-center gap-2">
            {i > 0 && <span className="text-muted-foreground/40">/</span>}
            {item.href && i < items.length - 1 ? (
              <a href={`#${item.href}`} className="hover:text-foreground">
                {item.label}
              </a>
            ) : (
              <span className={i === items.length - 1 ? 'text-foreground' : ''}>
                {item.label}
              </span>
            )}
          </li>
        ))}
      </ol>
    </nav>
  )
}