forked from Archives/Athou_commafeed
shorten count starting at 10k and add a tooltip with the exact count(#1150)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Badge, createStyles } from "@mantine/core"
|
import { Badge, createStyles, Tooltip } from "@mantine/core"
|
||||||
|
|
||||||
const useStyles = createStyles(() => ({
|
const useStyles = createStyles(() => ({
|
||||||
badge: {
|
badge: {
|
||||||
@@ -13,6 +13,10 @@ export function UnreadCount(props: { unreadCount: number }) {
|
|||||||
|
|
||||||
if (props.unreadCount <= 0) return null
|
if (props.unreadCount <= 0) return null
|
||||||
|
|
||||||
const count = props.unreadCount >= 1000 ? "999+" : props.unreadCount
|
const count = props.unreadCount >= 10000 ? "10k+" : props.unreadCount
|
||||||
return <Badge className={classes.badge}>{count}</Badge>
|
return (
|
||||||
|
<Tooltip label={props.unreadCount} disabled={props.unreadCount === count}>
|
||||||
|
<Badge className={classes.badge}>{count}</Badge>
|
||||||
|
</Tooltip>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user