forked from Archives/Athou_commafeed
19 lines
533 B
TypeScript
19 lines
533 B
TypeScript
import { Badge, createStyles } from "@mantine/core"
|
|
|
|
const useStyles = createStyles(() => ({
|
|
badge: {
|
|
width: "3.2rem",
|
|
// for some reason, mantine Badge has "cursor: 'default'"
|
|
cursor: "pointer",
|
|
},
|
|
}))
|
|
|
|
export function UnreadCount(props: { unreadCount: number }) {
|
|
const { classes } = useStyles()
|
|
|
|
if (props.unreadCount <= 0) return null
|
|
|
|
const count = props.unreadCount >= 1000 ? "999+" : props.unreadCount
|
|
return <Badge className={classes.badge}>{count}</Badge>
|
|
}
|