Add info about reaction on hover

This commit is contained in:
Jon Staab
2024-11-18 15:41:58 -08:00
parent 032b4bcefb
commit 50bf57772c
2 changed files with 21 additions and 3 deletions
+13
View File
@@ -0,0 +1,13 @@
export const displayList = <T>(xs: T[], conj = "and", n = 6, locale = "en-US") => {
const stringItems = xs.map(String)
if (xs.length > n + 2) {
const formattedList = new Intl.ListFormat(locale, {style: "long", type: "unit"}).format(
stringItems.slice(0, n),
)
return `${formattedList}, ${conj} ${xs.length - n} others`
}
return new Intl.ListFormat(locale, {style: "long", type: "conjunction"}).format(stringItems)
}