mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
21 lines
507 B
TypeScript
21 lines
507 B
TypeScript
import { chakra, Text } from '@chakra-ui/react';
|
|
|
|
type Props = {
|
|
value: string;
|
|
suffix?: string;
|
|
postfix?: string;
|
|
};
|
|
|
|
export default function NumberEntity({ value, suffix, postfix }: Props) {
|
|
const [ integer, decimal ] = value.split('.');
|
|
return (
|
|
<Text>
|
|
{ suffix }
|
|
{ Number(integer) ? Number(integer).toLocaleString() : integer }
|
|
{ decimal && '.' }
|
|
<chakra.span color="text.secondary">{ decimal }</chakra.span>
|
|
{ postfix && ` ${ postfix }` }
|
|
</Text>
|
|
);
|
|
}
|