1import{I as I2,L,z}from"./chunk-IIPGOJ4W.js";import{g}from"./chunk-7W3IZPRH.js";import{I}from"./chunk-3IXZY32A.js";function MobileMenu({navigationItems,currentPath}){let[isOpen,setIsOpen]=I2(!1),[expandedDropdowns,setExpandedDropdowns]=I2({}),menuRef=L(null),buttonRef=L(null);z(()=>{let handleClickOutside=event=>{isOpen&&menuRef.current&&buttonRef.current&&!menuRef.current.contains(event.target)&&!buttonRef.current.contains(event.target)&&setIsOpen(!1)};return document.addEventListener("click",handleClickOutside),()=>{document.removeEventListener("click",handleClickOutside)}},[isOpen]);let toggleDropdown=(path,event)=>{event.preventDefault(),event.stopPropagation(),setExpandedDropdowns(prev=>({...prev,[path]:!prev[path]}))},isDropdownActive=link=>!!(expandedDropdowns[link.path]||link.dropdownItems?.some(item=>item.path===currentPath)),ensureAbsolutePath=path=>path.startsWith("/")?path:`/${path}`;return g(I,{children:[g("button",{ref:buttonRef,onClick:()=>setIsOpen(!isOpen),class:"xl1:hidden z-10 p-2 relative","aria-label":isOpen?"Close menu":"Open menu",children:g("div",{class:"w-6 h-6 flex flex-col items-center justify-center",children:[g("span",{class:`bg-black block h-0.5 w-6 rounded-sm transition-all duration-300 ease-out ${isOpen?"rotate-45 translate-y-1":"-translate-y-1"}`}),g("span",{class:`bg-black block h-0.5 w-6 rounded-sm transition-all duration-300 ease-out my-0.5 ${isOpen?"opacity-0":"opacity-100"}`}),g("span",{class:`bg-black block h-0.5 w-6 rounded-sm transition-all duration-300 ease-out ${isOpen?"-rotate-45 -translate-y-1":"translate-y-1"}`})]})}),isOpen&&g("div",{ref:menuRef,class:"absolute top-full left-0 right-0 w-full bg-white shadow-lg xl1:hidden z-50 rounded-b-md",children:g("div",{class:"py-3",children:navigationItems.map(link=>g("div",{class:"mb-1",children:[g("div",{class:"flex items-center",children:[g("a",{href:ensureAbsolutePath(link.path),class:`flex-grow block px-4 py-2 text-black uppercase text-lg hover:bg-gray-50 ${currentPath===link.path?"font-bold":"opacity-70"}`,onClick:()=>{link.hasDropdown||setIsOpen(!1)},children:link.label}),link.hasDropdown&&g("button",{onClick:e=>
1toggleDropdown(link.path,e),class:"px-4 py-2","aria-label":expandedDropdowns[link.path]?"Collapse":"Expand",children:g("svg",{class:`w-5 h-5 transition-transform duration-200 ${expandedDropdowns[link.path]?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),link.hasDropdown&&link.dropdownItems&&g("div",{class:`bg-gray-50 overflow-hidden transition-all duration-300 ease-in-out ${isDropdownActive(link)?"max-h-96 py-2 mb-2 opacity-100":"max-h-0 py-0 mb-0 opacity-0"}`,children:link.dropdownItems.map(item=>g("a",{href:ensureAbsolutePath(item.path),class:`block px-8 py-2 text-md hover:bg-gray-100 whitespace-nowrap ${currentPath===item.path?"font-bold text-aarhus-red":"text-gray-800"}`,onClick:()=>setIsOpen(!1),children:item.label},item.path))})]},link.id))})})]})}export{MobileMenu as default}; 2//# sourceMappingURL=island-mobilemenu.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.