Skip to content

Commit

Permalink
Fix AddressCopier
Browse files Browse the repository at this point in the history
  • Loading branch information
mudrila committed Apr 29, 2024
1 parent bb1b771 commit 3151329
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/components/ui/links/AddressCopier.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { ButtonProps, Text } from '@chakra-ui/react';
import { Text, Icon, LinkProps } from '@chakra-ui/react';
import { CopySimple } from '@phosphor-icons/react';
import { useCopyText } from '../../../hooks/utils/useCopyText';
import useDisplayName from '../../../hooks/utils/useDisplayName';
import CeleryButtonWithIcon from '../utils/CeleryButtonWithIcon';
import EtherscanLinkAddress from './EtherscanLinkAddress';

interface Props extends ButtonProps {
interface Props extends LinkProps {
address: string;
}

Expand All @@ -18,15 +17,25 @@ export default function AddressCopier({ address, ...rest }: Props) {
const copyToClipboard = useCopyText();

return (
<CeleryButtonWithIcon
onClick={() => copyToClipboard(address)}
icon={CopySimple}
iconPosition="end"
<EtherscanLinkAddress
address={address}
onClick={e => {
e.preventDefault();
copyToClipboard(address);
}}
width="fit-content"
{...rest}
>
<EtherscanLinkAddress address={address}>
<Text>{accountSubstring}</Text>
</EtherscanLinkAddress>
</CeleryButtonWithIcon>
<Text
alignItems="center"
display="flex"
>
{accountSubstring}
<Icon
ml="0.5rem"
as={CopySimple}
/>
</Text>
</EtherscanLinkAddress>
);
}

0 comments on commit 3151329

Please sign in to comment.