Files
tom goriunovandGitHub 932add9d96 Change zero to <0.001 value within different pages (#3150)
* basic components and address page refactoring

* second part of refactoring

* third part of refactoring

* NativeCoinValue component

* more refactoring

* rename TruncatedValue into TruncatedText

* minor fixes

* refactor block details

* fix layout of value and fee in tx table

* update screenshots

* different units for tooltip and stats widget small value fix

* update screenshots

* update tx table screenshot

* fix copy button vertical alignment
2025-12-05 16:04:27 +01:00

59 lines
1.4 KiB
TypeScript

import type { BoxProps } from '@chakra-ui/react';
import { chakra } from '@chakra-ui/react';
import BigNumber from 'bignumber.js';
import React from 'react';
import { currencyUnits } from 'lib/units';
import { thinsp } from 'toolkit/utils/htmlEntities';
import SimpleValue from './SimpleValue';
import { GWEI, WEI } from './utils';
export interface Props extends Omit<BoxProps, 'prefix' | 'suffix'> {
amount: string;
asset?: string;
accuracy?: number;
noTooltip?: boolean;
loading?: boolean;
}
const GasPriceValue = ({
amount,
asset = currencyUnits.ether,
accuracy = 0,
noTooltip,
loading,
...rest
}: Props) => {
return (
<chakra.span
display="inline-flex"
flexWrap="wrap"
flexDirection="row"
alignItems="center"
maxW="100%"
columnGap={ 1 }
{ ...rest }
>
<SimpleValue
value={ BigNumber(amount).div(WEI) }
accuracy={ accuracy }
endElement={ asset ? `${ thinsp }${ asset }` : undefined }
noTooltip={ noTooltip }
loading={ loading }
/>
<SimpleValue
value={ BigNumber(amount).div(GWEI) }
accuracy={ accuracy }
startElement={ <span>(</span> }
endElement={ `${ thinsp }${ currencyUnits.gwei })` }
noTooltip={ noTooltip }
loading={ loading }
color="text.secondary"
/>
</chakra.span>
);
};
export default React.memo(GasPriceValue);