mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-29 14:00:05 +02:00

[web] Editor redesign: Improve badge locations for Rail buttons GitOrigin-RevId: 11eef60e6ab35003b21fa1ebf0bde4588c5f7228
17 lines
394 B
TypeScript
17 lines
394 B
TypeScript
import OLBadge from '@/features/ui/components/ol/ol-badge'
|
|
|
|
type RailIndicatorProps = {
|
|
type: 'danger' | 'warning' | 'info'
|
|
count: number
|
|
}
|
|
|
|
function formatNumber(num: number) {
|
|
if (num > 99) {
|
|
return '99+'
|
|
}
|
|
return Math.floor(num).toString()
|
|
}
|
|
|
|
export const RailIndicator = ({ count, type }: RailIndicatorProps) => {
|
|
return <OLBadge bg={type}>{formatNumber(count)}</OLBadge>
|
|
}
|