From 670e7bff70c0e011fa37e633ce62ffe76bf09412 Mon Sep 17 00:00:00 2001 From: Connor Bryan Date: Tue, 13 Nov 2018 17:18:16 -0600 Subject: [PATCH] [BUGSQUASH] Disallow clicking link on disabled WalletButton. --- .../WalletDecrypt/components/WalletButton.tsx | 48 ++++++++++++++----- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/common/components/WalletDecrypt/components/WalletButton.tsx b/common/components/WalletDecrypt/components/WalletButton.tsx index 8105f737bca..8158b0aa892 100644 --- a/common/components/WalletDecrypt/components/WalletButton.tsx +++ b/common/components/WalletDecrypt/components/WalletButton.tsx @@ -107,18 +107,40 @@ export class WalletButton extends React.PureComponent { )}
- {icons.map(i => ( - - {i.href ? ( - - - - ) : ( - - )} - {!isDisabled && {i.tooltip}} - - ))} + {icons.map(i => { + const IconWrapper = (props: any) => { + if (isDisabled) { + return {props.children}; + } + + if (i.href) { + return ( + + {props.children} + + ); + } + + return props.children; + }; + + return ( + + + + + {!isDisabled && {i.tooltip}} + + ); + })}
@@ -135,7 +157,7 @@ export class WalletButton extends React.PureComponent { this.props.onClick(this.props.walletType); }; - private stopPropogation = (ev: React.FormEvent) => { + private stopPropagation = (ev: React.FormEvent) => { ev.stopPropagation(); }; }