import { createStyles, Group, Text, Box } from '@mantine/core'; import { VscListSelection } from 'react-icons/vsc'; import type { DocClass } from '~/DocModel/DocClass'; import type { DocInterface } from '~/DocModel/DocInterface'; const useStyles = createStyles((theme) => ({ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment link: { ...theme.fn.focusStyles(), display: 'block', textDecoration: 'none', color: theme.colorScheme === 'dark' ? theme.colors.dark![0] : theme.black, lineHeight: 1.2, fontSize: theme.fontSizes.sm, padding: theme.spacing.xs, paddingLeft: theme.spacing.md, marginLeft: 8, borderTopRightRadius: theme.radius.sm, borderBottomRightRadius: theme.radius.sm, borderLeft: `1px solid ${theme.colorScheme === 'dark' ? theme.colors.dark![4] : theme.colors.gray![3]}`, '&:hover': { backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark![6] : theme.colors.gray![0], }, }, })); export function TableOfContentsItems({ members, }: { members: ReturnType['methods'] | ReturnType['methods']; }) { const { classes } = useStyles(); const items = members.map((member) => { const key = `${member.name}${member.overloadIndex && member.overloadIndex > 1 ? `:${member.overloadIndex}` : ''}`; return ( key={key} href={`#${key}`} component="a" className={classes.link}> {member.name} {member.overloadIndex && member.overloadIndex > 1 ? ( {member.overloadIndex} ) : null} ); }); return ( Table of contents {items} ); }