Sha256: 9ab59f3b53344df0060132badceeeff89515e98a82a504bd92af5f422c4c697a
Contents?: true
Size: 1.13 KB
Versions: 38
Compression:
Stored size: 1.13 KB
Contents
/* @flow */ import React from 'react' import classnames from 'classnames' import { buildCss } from '../utilities/props' import { Avatar } from '../' type MultipleUsersProps = { className?: String, id?: String, maxDisplayedUsers?: Number, reverse?: Boolean, users: Array<Object>, } const MultipleUsers = ({ className, id, maxDisplayedUsers = 4, reverse = false, users, }: MultipleUsersProps) => { const displayCount = users.length > maxDisplayedUsers ? maxDisplayedUsers - 1 : users.length const usersToDisplay = users.slice(0, displayCount) return ( <div className={classnames(className, buildCss('pb_multiple_users_kit', reverse && 'reverse'))} id={id} > {usersToDisplay.map((avatarData, index) => ( <Avatar {...avatarData} className="pb_multiple_users_item" key={index} size="xs" /> ))} <If condition={users.length > maxDisplayedUsers}> <div className="pb_multiple_users_item multiple_users_badge"> {`+${users.length - 3}`} </div> </If> </div> ) } export default MultipleUsers
Version data entries
38 entries across 38 versions & 1 rubygems