import { usePathname } from 'next/navigation' import { NavBar, NavBarMobile, NavIndicator, NavIndicators, NavLink, NavSideMenu, NavSideMenuButton, NavSideMenuPanel, NavSideMenuButtonPlaceholder, NavWrap, NavWrapMobile, NavWrapMobileGhost, NavSideMenuGhost } from './styles/navbar'; import { StyleSelector, StyleSelectorPlaceholder } from './themeselector'; import Links from '../public/data/navbar.json'; import { useState } from 'react'; import NavMenuFooter from './footer'; const PageNavbar = ({ mobile }: { mobile: number }) => { const path = usePathname(); const [sideBarActive, setSideBarActive] = useState(true); //DEBUG: set to false function handleSidebar(event: any) { if (!event.currentTarget.contains(event.relatedTarget)) { setSideBarActive(false); console.log(event.relatedTarget); // DEBUG } else { console.log("nah") } // DEBUG } let navbar: JSX.Element; if (mobile) { navbar = ( <> handleSidebar(event)} active={+sideBarActive}> {Links.links.map((item) => ( {item.name} ))} Mastodon setSideBarActive(!sideBarActive)} active={+sideBarActive}>Menu {Links.links.map((item) => ( ))} ); } else { navbar = ( {Links.links.map((item) => ( {item.name} ))} Mastodon ); } return navbar; } export default PageNavbar;