diff --git a/src/components/WalletDropdown/AuthenticatedHeader.tsx b/src/components/WalletDropdown/AuthenticatedHeader.tsx index 1c391433b4..dc3391735c 100644 --- a/src/components/WalletDropdown/AuthenticatedHeader.tsx +++ b/src/components/WalletDropdown/AuthenticatedHeader.tsx @@ -149,14 +149,15 @@ const AuthenticatedHeader = () => { - Copied! : Copy} /> - Explore} /> - Disconnect} - /> + + {isCopied ? Copied! : Copy} + + + Explore + + + Disconnect + diff --git a/src/components/WalletDropdown/IconButton.tsx b/src/components/WalletDropdown/IconButton.tsx index eeaba08a4f..2fe335a0e5 100644 --- a/src/components/WalletDropdown/IconButton.tsx +++ b/src/components/WalletDropdown/IconButton.tsx @@ -58,31 +58,28 @@ const IconWrapper = styled.span` width: 16px; height: 16px; ` - -interface IconButtonProps { - text: React.ReactNode +interface BaseProps { Icon: Icon - onClick?: () => void - href?: string - dataTestId?: string +} +interface IconLinkProps extends React.ComponentPropsWithoutRef<'a'>, BaseProps {} +interface IconButtonProps extends React.ComponentPropsWithoutRef<'button'>, BaseProps {} + +const IconBlock = (props: React.ComponentPropsWithoutRef<'a' | 'button'>) => { + if ('href' in props) { + return + } + // ignoring 'button' 'type' conflict between React and styled-components + // @ts-ignore + return } -const IconButton = ({ Icon, onClick, text, href, dataTestId }: IconButtonProps) => { - return href ? ( - - - - {text} - - - ) : ( - - - - {text} - - - ) -} +const IconButton = ({ Icon, children, ...rest }: IconButtonProps | IconLinkProps) => ( + + + + {children} + + +) export default IconButton