import { useLocation, Link } from 'react-router-dom'; import { ChevronRight } from 'lucide-react'; export default function Header() { const location = useLocation(); const getBreadcrumbs = () => { const paths = location.pathname.split('/').filter(Boolean); const breadcrumbs = [{ name: 'Home', path: '/' }]; let currentPath = ''; paths.forEach((segment) => { currentPath += `/${segment}`; const decodedSegment = decodeURIComponent(segment); // ✅ Decode "%20" → " " const name = decodedSegment .split('-') .map(word => word.charAt(0).toUpperCase() + word.slice(1)) .join(' '); breadcrumbs.push({ name, path: currentPath }); }); return breadcrumbs; }; const breadcrumbs = getBreadcrumbs(); return (
); }