rail-indicator.tsx 389 B

1234567891011121314151617
  1. import OLBadge from '@/shared/components/ol/ol-badge'
  2. type RailIndicatorProps = {
  3. type: 'danger' | 'warning' | 'info'
  4. count: number
  5. }
  6. function formatNumber(num: number) {
  7. if (num > 99) {
  8. return '99+'
  9. }
  10. return Math.floor(num).toString()
  11. }
  12. export const RailIndicator = ({ count, type }: RailIndicatorProps) => {
  13. return <OLBadge bg={type}>{formatNumber(count)}</OLBadge>
  14. }