1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

fix event bubbling on wallet selector button

* closes #197
This commit is contained in:
Matthias Kretschmann 2019-09-12 11:45:52 +02:00
parent 12f6cfcb80
commit e32f3bbb62
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -15,19 +15,20 @@ export default class WalletSelector extends PureComponent<
isModalOpen: false
}
private toggleModal = () => {
private handleToggleModal = (e?: Event) => {
e && e.preventDefault()
this.setState({ isModalOpen: !this.state.isModalOpen })
}
private loginBurnerWallet = () => {
this.context.loginBurnerWallet()
this.toggleModal()
this.handleToggleModal()
}
private loginMetamask = () => {
this.context.loginMetamask()
this.context.logoutBurnerWallet()
this.toggleModal()
this.handleToggleModal()
}
private WalletButton = ({
@ -80,7 +81,7 @@ export default class WalletSelector extends PureComponent<
<Button
link
className={styles.openLink}
onClick={this.toggleModal}
onClick={this.handleToggleModal}
data-action="wallet"
>
{content.title}
@ -89,7 +90,7 @@ export default class WalletSelector extends PureComponent<
title={content.title}
description={content.description}
isOpen={this.state.isModalOpen}
toggleModal={this.toggleModal}
toggleModal={this.handleToggleModal}
>
<div className={styles.info}>
{content.buttons.map(({ title, description, icon }) => (