import { ComponentProps, FC } from 'react' import round from 'utils/round' import { Text } from './' type PercentChangeProps = { value: number | undefined | null decimals?: number } type Props = ComponentProps & PercentChangeProps export const PercentChange: FC = ({ value, decimals = 2, ...props }) => { if (value === undefined || value === null || value === 0) return null const percentage = (value - 1) * 100 const isPositive = percentage > 0 return ( {percentage > 500 ? '>500' : round(percentage, decimals)}% ) }