import { Accessor, For, JSXElement, Match, Show, Switch, children } from "solid-js"; import { Avatar, AvatarProps } from "../Avatar"; import { Tooltip } from "../Tooltip"; import { useClassList } from "../utils/useProps"; type AvatarListProps = { classList?: any, class?: string, size?: 'small' | 'large', align?: 'top'|'bottom'|'left'|'right'|'topLeft'|'topRight'|'bottomLeft'|'bottomRight'|'leftTop'|'leftBottom'|'rightTop'|'rightBottom', max?: number, excessStyle?: any, children?: JSXElement } export function AvatarList (props: AvatarListProps) { const classList = () => useClassList(props, 'cm-avatar-list', { [`cm-avatar-list-${props.size}`]: props.size }); const max = () => props.max ?? Number.MAX_VALUE; const avatars = children(() => props.children) const evaluatedAvatars = () => avatars.toArray() as unknown as AvatarProps[]; const avatarsLength = () => evaluatedAvatars().length; return
{(item: AvatarProps, index: Accessor) => { item.asProps = false; if (index() < max()) { return
} }}
max() }>
+{avatarsLength() - max()}
; }