import { Box, Flex, Stack, Spacer, Text, IconProps } from '@chakra-ui/react'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { forwardRef } from 'react'; import type { MenuItem } from './index'; interface Props { item: MenuItem; index: number; scrollIndex: number; } const ListItem = forwardRef, Props>(({ item, index, scrollIndex }, ref) => { return ( { if (ref) // @ts-ignore i cba return (ref.current = [...ref.current, element]); }} > {item.icon && ( )} {Array.isArray(item.values) ? ( {item.label} {typeof item.values[scrollIndex] === 'object' ? // @ts-ignore for some reason even checking the type TS still thinks it's a string item.values[scrollIndex].label : item.values[scrollIndex]} {scrollIndex + 1}/{item.values.length} ) : ( {item.label} )} ); }); export default ListItem;