import React, {Children, Fragment, ReactElement, ReactNode} from 'react'; import {AvatarProps} from '@common/ui/images/avatar'; import clsx from 'clsx'; import {Trans} from '@common/i18n/trans'; import {Link} from 'react-router-dom'; interface AvatarGroupProps { children: ReactNode; className?: string; } export function AvatarGroup(props: AvatarGroupProps) { const children = Children.toArray( props.children ) as ReactElement[]; if (!children.length) return null; const firstLink = children[0].props.link; const label = children[0].props.label; return (
{children.map((avatar, index) => (
{avatar}
))}
{firstLink && label ? ( {label} ) : null} {children.length > 1 && ( {' '} )}
); }