import React from 'react'; import { Tooltip, Avatar } from 'antd'; import classNames from 'classnames'; import styles from './index.less'; const avatarSizeToClassName = size => classNames(styles.avatarItem, { [styles.avatarItemLarge]: size === 'large', [styles.avatarItemSmall]: size === 'small', [styles.avatarItemMini]: size === 'mini', }); const AvatarList = ({ children, size, maxLength, excessItemsStyle, ...other }) => { const numOfChildren = React.Children.count(children); const numToShow = maxLength >= numOfChildren ? numOfChildren : maxLength; const childrenWithProps = React.Children.toArray(children) .slice(0, numToShow) .map(child => React.cloneElement(child, { size, }) ); if (numToShow < numOfChildren) { const cls = avatarSizeToClassName(size); childrenWithProps.push(