import React, { type HTMLAttributes, type ReactNode } from 'react' import classnames from 'classnames' import { Avatar, type CompanyAvatarProps, type GenericAvatarProps } from '~components/Avatar' import { type OverrideClassName } from '~components/types/OverrideClassName' import styles from './AvatarGroup.module.css' export type AvatarGroupAvatarProps = | Omit | Omit export type AvatarGroupSize = 'small' | 'medium' | 'large' export type AvatarList = [AvatarGroupAvatarProps, ...AvatarGroupAvatarProps[]] export type AvatarGroupProps = { /** * There are 3 fixed sizes available. `"small"` will remove border and box shadow to save space. * @default "medium" */ size?: AvatarGroupSize /** * If the length of Avatars exceeds the `maxVisible` a counter token will render * @default 2 */ maxVisible: 2 | 3 | 4 | 5 | 6 /** * Takes a array of `AvatarProps` that must have at least item. * Note that 'size' is omitted from the `AvatarProps` type so it will throw a type error if size is provided. * */ avatars: AvatarList } & OverrideClassName> const Counter = ({ remainingAvatars }: { remainingAvatars: number }): ReactNode => { if (remainingAvatars <= 0) return null return (
  • 1 ? `are ${remainingAvatars} other members` : `is ${remainingAvatars} other member` } of this group`} className={styles.AvatarGroupItem} > {`+${remainingAvatars}`}
  • ) } const AllAvatars = ({ avatars, maxVisible, size, }: { avatars: AvatarList maxVisible: number size: AvatarGroupSize }): ReactNode => ( <> {avatars?.map( (avatarProps, index) => index < maxVisible && (
  • ), )} ) /** * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3065021264/Avatar+Group Guidance} | * {@link https://cultureamp.design/?path=/docs/components-avatar-avatar-group--docs Storybook} */ export const AvatarGroup = ({ size = 'medium', maxVisible = 2, avatars, classNameOverride, ...restProps }: AvatarGroupProps): JSX.Element => (
    )