Extract unit name

This commit is contained in:
Willian Mitsuda 2022-02-19 15:25:37 -03:00
parent dcc125293a
commit 40c2547565
1 changed files with 4 additions and 2 deletions

View File

@ -6,6 +6,7 @@ type TransactionValueProps = {
value: BigNumber;
decimals?: number;
hideUnit?: boolean;
unitName?: string;
};
/**
@ -22,16 +23,17 @@ const TransactionValue: React.FC<TransactionValueProps> = ({
value,
decimals = 18,
hideUnit,
unitName = "ETH",
}) => {
const formattedValue = formatValue(value, decimals);
return (
<span
className={`text-sm ${value.isZero() ? "text-gray-400" : ""}`}
title={`${formattedValue} Ether`}
title={`${formattedValue} ${unitName}`}
>
<span className={`font-balance`}>{formattedValue}</span>
{!hideUnit && " Ether"}
{!hideUnit && ` ${unitName}`}
</span>
);
};