import { useRef, useState } from 'react' import { Popover } from '@headlessui/react' import { ChevronDownIcon } from '@heroicons/react/outline' import Link from 'next/link' type NavDropMenuProps = { menuTitle: string | React.ReactNode linksArray: [string, string, boolean][] } export default function NavDropMenu({ menuTitle = '', linksArray = [], }: NavDropMenuProps) { const buttonRef = useRef(null) const [openState, setOpenState] = useState(false) const toggleMenu = () => { setOpenState((openState) => !openState) buttonRef?.current?.click() } const onHover = (open, action) => { if ( (!open && !openState && action === 'onMouseEnter') || (open && openState && action === 'onMouseLeave') ) { toggleMenu() } } const handleClick = (open) => { setOpenState(!open) } return (
) }