Fix facepile overflow

This commit is contained in:
Robert Long 2021-11-10 15:44:08 -08:00
parent 27f155e4a1
commit dc57166229
2 changed files with 15 additions and 1 deletions

View file

@ -1,6 +1,7 @@
import React from "react";
import styles from "./Facepile.module.css";
import ColorHash from "color-hash";
import classNames from "classnames";
const colorHash = new ColorHash({ lightness: 0.3 });
@ -10,7 +11,7 @@ export function Facepile({ participants }) {
className={styles.facepile}
title={participants.map((member) => member.name).join(", ")}
>
{participants.map((member) => (
{participants.slice(0, 3).map((member) => (
<div
key={member.userId}
className={styles.avatar}
@ -19,6 +20,14 @@ export function Facepile({ participants }) {
<span>{member.name.slice(0, 1).toUpperCase()}</span>
</div>
))}
{participants.length > 3 && (
<div
key="additional"
className={classNames(styles.avatar, styles.additional)}
>
<span>{`+${participants.length - 3}`}</span>
</div>
)}
</div>
);
}

View file

@ -8,6 +8,7 @@
width: 20px;
height: 20px;
border-radius: 20px;
background-color: #0dbd8b;
}
.facepile .avatar > * {
@ -24,3 +25,7 @@
width: 20px;
line-height: 20px;
}
.facepile .avatar.additional span {
font-size: 12px;
}