import React from 'react'; import Link from 'next/link'; import { cn } from '../../lib/utils'; import { Container } from '../ui/Container'; interface BreadcrumbItem { label: string; href?: string; icon?: React.ReactNode; } interface BreadcrumbsProps { items: BreadcrumbItem[]; separator?: React.ReactNode; className?: string; showHome?: boolean; homeLabel?: string; homeHref?: string; collapseMobile?: boolean; } export const Breadcrumbs: React.FC = ({ items, separator = '/', className = '', showHome = true, homeLabel = 'Home', homeHref = '/', collapseMobile = true, }) => { // Generate schema.org structured data const generateSchema = () => { const breadcrumbs = [ ...(showHome ? [{ label: homeLabel, href: homeHref }] : []), ...items, ].map((item, index) => ({ '@type': 'ListItem', position: index + 1, name: item.label, ...(item.href && { item: item.href }), })); return { '@context': 'https://schema.org', '@type': 'BreadcrumbList', itemListElement: breadcrumbs, }; }; // Render individual breadcrumb item const renderItem = (item: BreadcrumbItem, index: number, isLast: boolean) => { const isHome = showHome && index === 0 && item.href === homeHref; const content = ( {isHome && ( )} {item.icon && {item.icon}} {item.label} ); if (!isLast && item.href) { return ( {content} ); } return content; }; const allItems = [ ...(showHome ? [{ label: homeLabel, href: homeHref }] : []), ...items, ]; // Schema.org JSON-LD const schema = generateSchema(); return ( <> {/* Schema.org structured data */}