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