Files
explore/ui/tx/assetFlows/components/NovesTokenTooltipContent.tsx
tom goriunovandGitHub f6725649da UI toolkit package (#2691)
* 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
2025-04-21 19:44:22 +02:00

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);