import * as Accordion from '@radix-ui/react-accordion' import { useRouter } from 'next/router' import React from 'react' import NavigationMenuGuideListItems from './NavigationMenuGuideListItems' import * as NavItems from './NavigationMenu.constants' interface Props { id: string active: boolean collapsible?: boolean value?: string[] } const NavigationMenuGuideList: React.FC = ({ id, active, value }) => { const router = useRouter() const menu = NavItems[id] // get url const url = router.asPath // We need to decide how deep we want the menu to be for matching urls // if the links are really deep, we don't want to match all the way out // But we need to reach out further to make the structure of /resources/postgres/ work // look at /resources/postgres/ vs /auth/phone-login for how these are different let firstLevelRoute if (url.includes('resources/postgres/')) { firstLevelRoute = url?.split('/')?.slice(0, 5)?.join('/') } else { firstLevelRoute = url?.split('/')?.slice(0, 4)?.join('/') } return ( ) } export default NavigationMenuGuideList