mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
De-dupe click handler for sandwich-expando
This commit is contained in:
parent
4d6a289629
commit
10d3a519c8
@ -193,15 +193,17 @@ App.prototype.renderAppBar = function () {
|
|||||||
|
|
||||||
// hamburger
|
// hamburger
|
||||||
props.isUnlocked && h(SandwichExpando, {
|
props.isUnlocked && h(SandwichExpando, {
|
||||||
|
className: 'sandwich-expando',
|
||||||
width: 16,
|
width: 16,
|
||||||
barHeight: 2,
|
barHeight: 2,
|
||||||
padding: 0,
|
padding: 0,
|
||||||
isOpen: state.isMainMenuOpen,
|
isOpen: state.isMainMenuOpen,
|
||||||
color: 'rgb(247,146,30)',
|
color: 'rgb(247,146,30)',
|
||||||
onClick: (event) => {
|
onClick: () => {
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
this.setState({ isMainMenuOpen: !state.isMainMenuOpen })
|
this.setState({
|
||||||
|
isMainMenuOpen: !state.isMainMenuOpen,
|
||||||
|
})
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
@ -340,9 +342,13 @@ App.prototype.renderDropdown = function () {
|
|||||||
isOpen: isOpen,
|
isOpen: isOpen,
|
||||||
zIndex: 11,
|
zIndex: 11,
|
||||||
onClickOutside: (event) => {
|
onClickOutside: (event) => {
|
||||||
const { classList } = event.target
|
const classList = event.target.classList
|
||||||
const isNotToggleElement = !classList.contains('sandwich-expando')
|
const parentClassList = event.target.parentElement.classList
|
||||||
if (isNotToggleElement) {
|
|
||||||
|
const isToggleElement = classList.contains('sandwich-expando') ||
|
||||||
|
parentClassList.contains('sandwich-expando')
|
||||||
|
|
||||||
|
if (isOpen && !isToggleElement) {
|
||||||
this.setState({ isMainMenuOpen: false })
|
this.setState({ isMainMenuOpen: false })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user