import { ReactNode } from 'react'; import { Flex } from '../Flex'; import { Heading } from '../Heading'; import { Popover } from '../Popover'; import { Container, More, Hover } from './styles'; type AvatarGroupProps = { children: ReactNode[]; }; export function AvatarGroup({ children }: AvatarGroupProps): JSX.Element { return ( {children?.length > 5 && ( +{children.length - 5} {children.slice(5).map((item: any) => ( {item?.props.name} ))} )} {children?.length < 6 ? children.map((item: any) => ( {item} )) : children .slice(0, 5) .map((item: any) => {item})} ); }