import { Link, useMatches } from '@remix-run/react'; interface BreadcrumbItem { title: string; to?: string; } interface BreadcrumbProps { items?: BreadcrumbItem[]; className?: string; } interface Handle { breadcrumb: string | ((data: any) => string); } interface Match { handle?: Handle; pathname: string; data: any; } export function Breadcrumb({ items = [], className = '' }: BreadcrumbProps) { const matches = useMatches() as Match[]; const breadcrumbs = items.length > 0 ? items : matches .filter(match => match.handle?.breadcrumb) .map(match => ({ title: typeof match.handle?.breadcrumb === 'function' ? match.handle.breadcrumb(match.data) : match.handle?.breadcrumb, to: match.pathname })); if (breadcrumbs.length === 0) { return null; } return ( ); }