aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components/ui/balance.tsx
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-07-07 05:09:36 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-07-07 05:21:30 +0800
commit9669a4d1216b7d22107580daf3e2bff464eb2ade (patch)
treee408ae8281b8fc09ac253b7547027639e5f2943c /packages/website/ts/components/ui/balance.tsx
parent7418926ebb156165f328a89cf58ec758737ee999 (diff)
downloaddexon-0x-contracts-9669a4d1216b7d22107580daf3e2bff464eb2ade.tar.gz
dexon-0x-contracts-9669a4d1216b7d22107580daf3e2bff464eb2ade.tar.zst
dexon-0x-contracts-9669a4d1216b7d22107580daf3e2bff464eb2ade.zip
Create Balance component and make token symbols smaller than token amounts
Diffstat (limited to 'packages/website/ts/components/ui/balance.tsx')
-rw-r--r--packages/website/ts/components/ui/balance.tsx27
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/website/ts/components/ui/balance.tsx b/packages/website/ts/components/ui/balance.tsx
new file mode 100644
index 000000000..9e5a256b6
--- /dev/null
+++ b/packages/website/ts/components/ui/balance.tsx
@@ -0,0 +1,27 @@
+import { BigNumber } from '@0xproject/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>
+ );
+};