import { Box, BoxProps, chakra, ListItem, OrderedList, useColorModeValue, } from '@chakra-ui/react' import { useScrollSpy } from 'hooks/use-scrollspy' import type { FrontmatterHeading } from 'src/types/frontmatter' import { t } from 'utils/i18n' import { FigmaPluginAd } from './figma-plugin-ad' import TocNav from './toc-nav' interface TableOfContentProps extends BoxProps { headings: FrontmatterHeading[] } function TableOfContent(props: TableOfContentProps) { const { headings, ...rest } = props const activeId = useScrollSpy( headings.map(({ id }) => `[id="${id}"]`), { rootMargin: '-10% 0% -24% 0%', }, ) const linkColor = useColorModeValue('gray.600', 'gray.400') const linkHoverColor = useColorModeValue('gray.900', 'gray.600') return ( {headings.map(({ id, text, level }) => ( {text} ))} ) } export default TableOfContent