import { FC } from 'react'; import { Link, Stack, Text } from '@chakra-ui/react'; import NextLink from 'next/link'; import { useRouter } from 'next/router'; import { NavLink } from '../../../types'; interface LinksListProps { links: NavLink[]; } export const LinksList: FC = ({ links }) => { const router = useRouter(); const { slug } = router.query; return ( {links.map(({ id, to, items }) => { const split = to?.split('/') const isActive = slug && split && split[split.length - 1] === slug[slug.length - 1]; return to ? ( {id} {items && } ) : ( {id} {items && } ); })} ); };