import type { HTMLChakraProps } from '@chakra-ui/react'; import { Box, Flex } from '@chakra-ui/react'; import { clamp } from 'es-toolkit'; import React from 'react'; import { Skeleton } from 'toolkit/chakra/skeleton'; interface Props extends Omit, 'direction'> { value: number; colorScheme?: 'green' | 'gray'; isLoading?: boolean; } const WIDTH = 50; const Utilization = ({ value, colorScheme = 'green', isLoading, ...rest }: Props, ref: React.Ref) => { const valueString = (clamp(value * 100 || 0, 0, 100)).toLocaleString(undefined, { maximumFractionDigits: 2 }) + '%'; const color = colorScheme === 'gray' ? 'text.secondary' : 'green.500'; return ( { valueString } ); }; export default React.memo(React.forwardRef(Utilization));