// @flow import React from 'react'; import { UserAvatar } from 'src/components/avatar'; import type { ParticipantType } from 'shared/graphql/fragments/directMessageThread/directMessageThreadInfo'; import { AvatarContainer, TwoAvatarContainer, TwoAvatarWrap, ThreeAvatarContainer, Remainder, } from './style'; export const renderAvatars = (users: Array) => { if (users.length === 1) { return ( ); } if (users.length === 2) { return ( {users.map(user => { return ( ); })} ); } if (users.length === 3) { return ( {users.map(user => { return ( ); })} ); } if (users.length === 4) { return ( {users.map(user => { return ( ); })} ); } if (users.length > 4) { const remainder = users.length % 4; return ( {users.map((user, i) => { while (i < 3) { return ( ); } return null; })} +{remainder} ); } return null; };