Commit fe6360b1 authored by isstuev's avatar isstuev

add accuracy

parent 27e29e0b
...@@ -10,10 +10,11 @@ interface Props { ...@@ -10,10 +10,11 @@ interface Props {
currency?: string; currency?: string;
exchangeRate?: string; exchangeRate?: string;
className?: string; className?: string;
accuracy?: number;
accuracyUsd?: number; accuracyUsd?: number;
} }
const CurrencyValue = ({ value, currency = '', unit = 'wei', exchangeRate, className, accuracyUsd }: Props) => { const CurrencyValue = ({ value, currency = '', unit = 'wei', exchangeRate, className, accuracy, accuracyUsd }: Props) => {
let unitBn: BigNumber.Value; let unitBn: BigNumber.Value;
switch (unit) { switch (unit) {
case 'wei': case 'wei':
...@@ -34,7 +35,7 @@ const CurrencyValue = ({ value, currency = '', unit = 'wei', exchangeRate, class ...@@ -34,7 +35,7 @@ const CurrencyValue = ({ value, currency = '', unit = 'wei', exchangeRate, class
return ( return (
<Box as="span" className={ className }> <Box as="span" className={ className }>
<Text as="span"> <Text as="span">
{ valueCurr.toFixed() }{ currency ? ` ${ currency }` : '' } { accuracy ? valueCurr.toFixed(accuracy) : valueCurr.toFixed() }{ currency ? ` ${ currency }` : '' }
</Text> </Text>
{ exchangeRate !== undefined && exchangeRate !== null && { exchangeRate !== undefined && exchangeRate !== null &&
// TODO: mb need to implement rounding to the first significant digit // TODO: mb need to implement rounding to the first significant digit
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment