mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* 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
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import type { BoxProps } from '@chakra-ui/react';
|
|
import React from 'react';
|
|
|
|
import type { TokenInfo } from 'types/api/token';
|
|
|
|
import type { EntityProps as TokenEntityProps } from 'ui/shared/entities/token/TokenEntity';
|
|
import TokenEntity from 'ui/shared/entities/token/TokenEntity';
|
|
import TokenEntityL1 from 'ui/shared/entities/token/TokenEntityL1';
|
|
|
|
import type { Props as AssetValueProps } from './AssetValue';
|
|
import AssetValue from './AssetValue';
|
|
|
|
interface Props extends Omit<AssetValueProps, 'asset'> {
|
|
token: TokenInfo;
|
|
tokenEntityProps?: Omit<TokenEntityProps, 'token'> & BoxProps;
|
|
layer?: 'L1';
|
|
}
|
|
|
|
const TokenValue = ({ token, tokenEntityProps, layer, ...rest }: Props) => {
|
|
const TokenComponent = layer === 'L1' ? TokenEntityL1 : TokenEntity;
|
|
|
|
const asset = (
|
|
<TokenComponent
|
|
token={ token }
|
|
noCopy
|
|
onlySymbol
|
|
flexShrink={ 0 }
|
|
w="fit-content"
|
|
ml={ 2 }
|
|
icon={{ marginRight: 1 }}
|
|
{ ...tokenEntityProps }
|
|
/>
|
|
);
|
|
return (
|
|
<AssetValue
|
|
asset={ asset }
|
|
exchangeRate={ token.exchange_rate }
|
|
decimals={ token.decimals }
|
|
{ ...rest }
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default React.memo(TokenValue);
|