import { useContext } from 'react' import { useTranslation } from "react-i18next"; import { Link } from 'react-router-dom' import { SubMenuContext } from '@/contexts/contexts' import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/shadcn/ui/accordion" export const AccordionMenu = ({ title, to, isActive }) => { const { t } = useTranslation(); return ( {t(title)} ) } export const SubMenu = () => { const { menuItems, activeLink } = useContext(SubMenuContext) const allItemValues = menuItems.map((_, index) => `item-${index}`); return ( <> {menuItems.map((item, index) => { const isActive = activeLink === item.to || (item.subMenus && item.subMenus.some(subItem => subItem.to === activeLink)) const combinedClassName = ` ${isActive ? `active !text-data` : ''} ${item.className || ''} `.trim(); return ( item.subMenus && item.subMenus.length > 0 ? ( {Array.isArray(item.title) ? ( <> {item.title[0]} {item.title[1]} ) : ( item.title )}
{item.subMenus.map((el) => ( ))}
) : ( {Array.isArray(item.title) ? ( <> {item.title[0]} {item.title[1]} ) : ( item.title ) } ) ) })} ) } const HeaderMenu = () => { return ( <>
) } export default HeaderMenu