import { useContext, useEffect, useState } from 'react' import { Link, useLocation } 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 }) => { return ( {title} ) } export const SubMenu = () => { const { menuItems, activeLink } = useContext(SubMenuContext) // const location = useLocation() 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 ( // 메뉴 Data에 서브메뉴가 있을 시 아코디언 컴포넌트로 출력 item.subMenus && item.subMenus.length > 0 ? ( {Array.isArray(item.title) ? ( <> {item.title[0]} {item.title[1]} ) : ( item.title )}
{/*서브 메뉴 출력 */} {item.subMenus.map((el) => ( ))} {/* 서브 메뉴 출력 END */}
) : ( // 서브메뉴가 없을 시 기본 메뉴로 출력 {/* */} {Array.isArray(item.title) ? ( <> {item.title[0]} {item.title[1]} ) : ( item.title )} )) } ) } ) } const HeaderMenu = () => { return ( <>
{/* 상단 브랜드 로고 -- Page Header -- */}
) } export default HeaderMenu