import { useContext } from 'react' import { SubMenuContext } from '@/contexts/contexts' import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, } from "@/components/shadcn/ui/breadcrumb" import { Link, useLocation } from 'react-router-dom' const SegmentLink = () => { const location = useLocation() const { pathname } = location const segments = pathname.split('/') let url = ''; const breadcrumbLinks = segments.map((segment, i) => { const formattedSegment = segment.replace(/-/g, ' '); const capitalizedSegment = formattedSegment.charAt(0).toUpperCase() + formattedSegment.slice(1); url += `${capitalizedSegment}`; return ( {capitalizedSegment === '' ? '' : capitalizedSegment} ) }) return breadcrumbLinks; } const HeaderMenuBreadCrumb = () => { const { menuItems, activeLink } = useContext(SubMenuContext) const location = useLocation() return (
{menuItems.map((item, index) => { const isActive = activeLink === item.to || (item.subMenus && item.subMenus.some(subItem => subItem.to === activeLink)) return ( isActive ?

{item.title}

: '' ) })}
Home { location.pathname === '/' ? '' : } { }
) } export default HeaderMenuBreadCrumb;