aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components/ui/balance.tsx
blob: a1a8ff89b2f8048dd3e285dfcd48c0fbcf2b1c08 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { BigNumber } from '@0x/utils';
import * as React from 'react';
import { Container } from 'ts/components/ui/container';
import { Text } from 'ts/components/ui/text';
import { utils } from 'ts/utils/utils';

export interface BalanceProps {
    amount: BigNumber;
    decimals: number;
    symbol: string;
}

export const Balance: React.StatelessComponent<BalanceProps> = ({ amount, decimals, symbol }) => {
    const formattedAmout = utils.getFormattedAmount(amount, decimals);
    return (
        <span>
            <Text Tag="span" fontSize="16px" fontWeight="700" lineHeight="1em">
                {formattedAmout}
            </Text>
            <Container marginLeft="0.3em" Tag="span">
                <Text Tag="span" fontSize="12px" fontWeight="700" lineHeight="1em">
                    {symbol}
                </Text>
            </Container>
        </span>
    );
};