import { useState } from 'react' import { useRouter } from 'next/router' import { QuestionMarkCircleIcon } from '@heroicons/react/outline' import Link from 'next/link' import * as MonoIcons from './icons' import { initialMarket } from './SettingsModal' // const isMarketSelected = () export default function MarketMenuItem({ menuTitle = '', linksArray = [] }) { const { asPath } = useRouter() const [openState, setOpenState] = useState(false) const iconName = `${menuTitle.slice(0, 1)}${menuTitle .slice(1, 4) .toLowerCase()}MonoIcon` const SymbolIcon = MonoIcons[iconName] || QuestionMarkCircleIcon const onHover = (open, action) => { if ( (!open && action === 'onMouseEnter') || (open && action === 'onMouseLeave') ) { setOpenState((openState) => !openState) } } const isSelected = asPath.includes(`=${menuTitle}`) || (asPath === '/' && initialMarket.name.includes(menuTitle)) return (