From dc571662291292e8f5dbff98411d7756853be40a Mon Sep 17 00:00:00 2001 From: Robert Long Date: Wed, 10 Nov 2021 15:44:08 -0800 Subject: [PATCH] Fix facepile overflow --- src/Facepile.jsx | 11 ++++++++++- src/Facepile.module.css | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Facepile.jsx b/src/Facepile.jsx index b305c6d3..ae97161f 100644 --- a/src/Facepile.jsx +++ b/src/Facepile.jsx @@ -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) => (
{member.name.slice(0, 1).toUpperCase()}
))} + {participants.length > 3 && ( +
+ {`+${participants.length - 3}`} +
+ )} ); } diff --git a/src/Facepile.module.css b/src/Facepile.module.css index 02c5f6ed..3353738e 100644 --- a/src/Facepile.module.css +++ b/src/Facepile.module.css @@ -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; +}