Skip to content

Commit

Permalink
don't use prop destructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAlec committed Aug 9, 2024
1 parent 09c2397 commit 2a136a1
Showing 1 changed file with 27 additions and 20 deletions.
47 changes: 27 additions & 20 deletions src/wallet/components/WalletDropdownFundLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,37 @@ export function WalletDropdownFundLink({
window.open(url, 'Coinbase Fund Wallet', windowFeatures);
};

const commonProps = {
className: cn(
pressable.default,
'relative flex items-center px-4 py-3',
className,
),
};

const linkProps =
openIn === 'tab'
? {
...commonProps,
href: `http://keys.coinbase.com/funding?dappName=${tabName}&dappUrl=${currentURL}`,
target,
rel,
}
: { ...commonProps, onClick: handleClick };
const commonClassName = cn(
pressable.default,
'relative flex items-center px-4 py-3',
className
);

return (
<a {...linkProps}>
const linkContent = (
<>
<div className="-translate-y-1/2 absolute top-1/2 left-4 flex h-4 w-4 items-center justify-center">
{iconSvg}
</div>
<span className={cn(themeText.body, 'pl-6')}>{text}</span>
</a>
</>
);

if (openIn === 'tab') {
return (
<a
className={commonClassName}
href={`http://keys.coinbase.com/funding?dappName=${tabName}&dappUrl=${currentURL}`}
target={target}
rel={rel}
>
{linkContent}
</a>
);
} else {
return (
<a className={commonClassName} onClick={handleClick}>
{linkContent}
</a>
);
}
}

0 comments on commit 2a136a1

Please sign in to comment.