mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
d375dc550d
* replacing constants * updating ButtonLink component * Updates to responsive typography * lint fixes * snapshot updates --------- Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { useI18nContext } from '../../../../hooks/useI18nContext';
|
|
import { useCopyToClipboard } from '../../../../hooks/useCopyToClipboard';
|
|
|
|
import Tooltip from '../../../ui/tooltip';
|
|
|
|
import {
|
|
Display,
|
|
TextColor,
|
|
} from '../../../../helpers/constants/design-system';
|
|
|
|
import { shortenAddress } from '../../../../helpers/utils/util';
|
|
import { Text, Box, ButtonLink, IconName } from '../../../component-library';
|
|
|
|
const DetectedTokenAddress = ({ tokenAddress }) => {
|
|
const t = useI18nContext();
|
|
const [copied, handleCopy] = useCopyToClipboard();
|
|
|
|
return (
|
|
<Box display={Display.InlineFlex} className="detected-token-address">
|
|
<Text color={TextColor.textDefault}>{`${t('tokenAddress')}:`}</Text>
|
|
<Tooltip
|
|
position="bottom"
|
|
title={copied ? t('copiedExclamation') : t('copyToClipboard')}
|
|
>
|
|
<ButtonLink
|
|
className="detected-token-address__copy-link"
|
|
onClick={() => {
|
|
handleCopy(tokenAddress);
|
|
}}
|
|
endIconName={IconName.Copy}
|
|
marginLeft={2}
|
|
marginRight={2}
|
|
>
|
|
{shortenAddress(tokenAddress)}
|
|
</ButtonLink>
|
|
</Tooltip>
|
|
</Box>
|
|
);
|
|
};
|
|
|
|
DetectedTokenAddress.propTypes = {
|
|
tokenAddress: PropTypes.string,
|
|
};
|
|
|
|
export default DetectedTokenAddress;
|