1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 15:50:28 +01:00
metamask-extension/ui/components/app/detected-token/detected-token-address/detected-token-address.js
Ananyamadhu08 b53d335b2c
Part of 17670: Replace Typography with Text in detected-token-address.js (#18435)
* feat: replaced typography with text comp

* fix: changed h7 to h6

---------

Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
2023-04-24 14:49:35 +05:30

61 lines
1.6 KiB
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import { useI18nContext } from '../../../../hooks/useI18nContext';
import { useCopyToClipboard } from '../../../../hooks/useCopyToClipboard';
import Box from '../../../ui/box';
import Button from '../../../ui/button';
import Tooltip from '../../../ui/tooltip';
import {
DISPLAY,
TextColor,
TextVariant,
} from '../../../../helpers/constants/design-system';
import { shortenAddress } from '../../../../helpers/utils/util';
import { Text } from '../../../component-library';
const DetectedTokenAddress = ({ tokenAddress }) => {
const t = useI18nContext();
const [copied, handleCopy] = useCopyToClipboard();
return (
<Box display={DISPLAY.INLINE_FLEX} className="detected-token-address">
<Text variant={TextVariant.bodySm} as="h6" color={TextColor.textDefault}>
{`${t('tokenAddress')}:`}
</Text>
<Text
variant={TextVariant.bodySm}
as="h6"
color={TextColor.primaryDefault}
marginLeft={2}
marginRight={2}
>
{shortenAddress(tokenAddress)}
</Text>
<Tooltip
position="bottom"
title={copied ? t('copiedExclamation') : t('copyToClipboard')}
>
<Button
type="link"
className="detected-token-address__copy-link"
onClick={() => {
handleCopy(tokenAddress);
}}
>
<i className="fa fa-copy" />
</Button>
</Tooltip>
</Box>
);
};
DetectedTokenAddress.propTypes = {
tokenAddress: PropTypes.string,
};
export default DetectedTokenAddress;