mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* first version of the pack * single entry point * add custom components to the package * move form components to toolkit * add more utils and hooks to the package * minor fixes * add CI workflow * update readme and package.json * fix ts * fix build of env-validator * fix docker build * fix icons size * test fixes * more test fixes
54 lines
1.4 KiB
TypeScript
54 lines
1.4 KiB
TypeScript
import { Box, Text } from '@chakra-ui/react';
|
|
import type { FC } from 'react';
|
|
import React from 'react';
|
|
|
|
import type { NovesNft, NovesToken } from 'types/api/noves';
|
|
|
|
import { HEX_REGEXP } from 'toolkit/utils/regexp';
|
|
import CopyToClipboard from 'ui/shared/CopyToClipboard';
|
|
|
|
interface Props {
|
|
amount?: string;
|
|
token: NovesToken | NovesNft | undefined;
|
|
}
|
|
|
|
const NovesTokenTooltipContent: FC<Props> = ({ token, amount }) => {
|
|
if (!token) {
|
|
return null;
|
|
}
|
|
|
|
const showTokenName = token.symbol !== token.name;
|
|
const showTokenAddress = HEX_REGEXP.test(token.address);
|
|
|
|
return (
|
|
<Box color={{ _light: 'white', _dark: 'blackAlpha.900' }} display="flex" flexDir="column" alignItems="center" gap={ 1 }>
|
|
<Text as="p" color="inherit" fontWeight="semibold">
|
|
<Text color="inherit" as="span">
|
|
{ amount }
|
|
</Text>
|
|
<Text color="inherit" as="span" ml={ 1 }>
|
|
{ token.symbol }
|
|
</Text>
|
|
</Text>
|
|
|
|
{ showTokenName && (
|
|
<Text as="p" color="inherit" fontWeight="semibold" mt="6px">
|
|
{ token.name }
|
|
</Text>
|
|
) }
|
|
|
|
{ showTokenAddress && (
|
|
<Box display="flex" alignItems="center">
|
|
<Text color="inherit" fontWeight="normal">
|
|
{ token.address }
|
|
</Text>
|
|
<CopyToClipboard text={ token.address }/>
|
|
</Box>
|
|
) }
|
|
|
|
</Box>
|
|
);
|
|
};
|
|
|
|
export default React.memo(NovesTokenTooltipContent);
|