import { FC } from 'react'; import { Accordion, AccordionButton, AccordionItem, AccordionPanel, Center, Link, Stack, Text } from '@chakra-ui/react'; import { AddIcon, MinusIcon } from '../svgs/'; import NextLink from 'next/link'; import { useRouter } from 'next/router'; import { LinksList } from './'; import { NavLink } from '../../../types'; interface Props { navLinks: NavLink[]; } export const DocsLinks: FC = ({ navLinks }) => { const router = useRouter(); const { slug } = router.query; return ( {navLinks.map(({ id, to, items }, idx) => { const split = to?.split('/'); const isActive = slug && split && split[split.length - 1] === slug[slug.length - 1]; return ( {({ isExpanded }) => ( <> {to ? ( {id} ) : ( {id} )} {items && (
{isExpanded ? ( ) : ( )}
)}
{items && ( )} )}
); })}
); };