import { Text, TextProps } from "./../Text"; import { useMemo } from "react"; import CountUp from "react-countup"; export interface BalanceProps extends TextProps { value: number; decimals?: number; unit?: string; isDisabled?: boolean; prefix?: string; onClick?: (event: React.MouseEvent) => void; strikeThrough?: boolean; startFromValue?: boolean; } const Balance: React.FC> = ({ value, color = "text", decimals = 3, isDisabled = false, unit, prefix, onClick, strikeThrough, startFromValue = false, ...props }) => { const prefixProp = useMemo(() => (prefix ? { prefix } : {}), [prefix]); const suffixProp = useMemo(() => (unit ? { suffix: unit } : {}), [unit]); const showDecimals = useMemo(() => value % 1 !== 0, [value]); return ( {({ countUpRef }) => ( )} ); }; export default Balance;