Fix facepile overflow
This commit is contained in:
parent
27f155e4a1
commit
dc57166229
2 changed files with 15 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import styles from "./Facepile.module.css";
|
import styles from "./Facepile.module.css";
|
||||||
import ColorHash from "color-hash";
|
import ColorHash from "color-hash";
|
||||||
|
import classNames from "classnames";
|
||||||
|
|
||||||
const colorHash = new ColorHash({ lightness: 0.3 });
|
const colorHash = new ColorHash({ lightness: 0.3 });
|
||||||
|
|
||||||
|
@ -10,7 +11,7 @@ export function Facepile({ participants }) {
|
||||||
className={styles.facepile}
|
className={styles.facepile}
|
||||||
title={participants.map((member) => member.name).join(", ")}
|
title={participants.map((member) => member.name).join(", ")}
|
||||||
>
|
>
|
||||||
{participants.map((member) => (
|
{participants.slice(0, 3).map((member) => (
|
||||||
<div
|
<div
|
||||||
key={member.userId}
|
key={member.userId}
|
||||||
className={styles.avatar}
|
className={styles.avatar}
|
||||||
|
@ -19,6 +20,14 @@ export function Facepile({ participants }) {
|
||||||
<span>{member.name.slice(0, 1).toUpperCase()}</span>
|
<span>{member.name.slice(0, 1).toUpperCase()}</span>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
{participants.length > 3 && (
|
||||||
|
<div
|
||||||
|
key="additional"
|
||||||
|
className={classNames(styles.avatar, styles.additional)}
|
||||||
|
>
|
||||||
|
<span>{`+${participants.length - 3}`}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
|
background-color: #0dbd8b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.facepile .avatar > * {
|
.facepile .avatar > * {
|
||||||
|
@ -24,3 +25,7 @@
|
||||||
width: 20px;
|
width: 20px;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.facepile .avatar.additional span {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue