Skip to content

Commit

Permalink
Merge pull request #2269 from MyCryptoHQ/release/1.4.2.1
Browse files Browse the repository at this point in the history
Release 1.4.2.1
  • Loading branch information
ConnorBryan authored Nov 16, 2018
2 parents 1ed60e6 + eb9ab70 commit 21abebf
Showing 1 changed file with 35 additions and 32 deletions.
67 changes: 35 additions & 32 deletions common/components/WalletDecrypt/components/WalletButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,9 @@ interface Icon {
arialabel: string;
}

interface State {
hoveringIcon: string | null;
}

type Props = OwnProps & StateProps;

export class WalletButton extends React.PureComponent<Props, State> {
public state = {
hoveringIcon: null
};

export class WalletButton extends React.PureComponent<Props> {
public render() {
const {
name,
Expand Down Expand Up @@ -115,25 +107,40 @@ export class WalletButton extends React.PureComponent<Props, State> {
)}

<div className="WalletButton-icons">
{icons.map(i => (
<span
className="WalletButton-icons-icon"
key={i.icon}
onClick={this.stopPropagation}
onMouseEnter={() => this.setHoveringIcon(i.icon)}
onMouseLeave={this.clearHoveringIcon}
>
{i.href ? (
<NewTabLink href={i.href} onClick={this.stopPropagation} aria-label={i.arialabel}>
<i className={`fa fa-${i.icon}`} />
</NewTabLink>
) : (
<i className={`fa fa-${i.icon}`} aria-label={i.arialabel} />
)}
{!isDisabled &&
this.state.hoveringIcon === i.icon && <Tooltip size="sm">{i.tooltip}</Tooltip>}
</span>
))}
{icons.map(i => {
const IconWrapper = (props: any) => {
if (isDisabled) {
return <React.Fragment>{props.children}</React.Fragment>;
}

if (i.href) {
return (
<NewTabLink
href={i.href}
onClick={this.stopPropagation}
aria-label={i.arialabel}
>
{props.children}
</NewTabLink>
);
}

return props.children;
};

return (
<span
className="WalletButton-icons-icon"
key={i.icon}
onClick={this.stopPropagation}
>
<IconWrapper>
<i className={`fa fa-${i.icon}`} aria-label={i.arialabel} />
</IconWrapper>
{!isDisabled && <Tooltip size="sm">{i.tooltip}</Tooltip>}
</span>
);
})}
</div>
</div>

Expand All @@ -142,10 +149,6 @@ export class WalletButton extends React.PureComponent<Props, State> {
);
}

private setHoveringIcon = (hoveringIcon: string | null) => this.setState({ hoveringIcon });

private clearHoveringIcon = () => this.setHoveringIcon(null);

private handleClick = () => {
if (this.props.isDisabled || this.props.isFormatDisabled) {
return;
Expand Down

0 comments on commit 21abebf

Please sign in to comment.