aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/dropdowns/network-dropdown.js
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@gmail.com>2017-12-02 06:19:53 +0800
committerAlexander Tseung <alextsg@gmail.com>2017-12-02 06:19:53 +0800
commit7dba114feb428f7f2f78fee5611377b04bff5be6 (patch)
tree1518258a74392a4c79ec1957d65816ba610d1168 /ui/app/components/dropdowns/network-dropdown.js
parent2b1f2557c7dbd589724fd690ec72f789f9650e3c (diff)
downloadtangerine-wallet-browser-7dba114feb428f7f2f78fee5611377b04bff5be6.tar.gz
tangerine-wallet-browser-7dba114feb428f7f2f78fee5611377b04bff5be6.tar.zst
tangerine-wallet-browser-7dba114feb428f7f2f78fee5611377b04bff5be6.zip
Update font weights to 300, remove animation from network dropdown, fix network dropdown not closing from certain click-areas
Diffstat (limited to 'ui/app/components/dropdowns/network-dropdown.js')
-rw-r--r--ui/app/components/dropdowns/network-dropdown.js27
1 files changed, 16 insertions, 11 deletions
diff --git a/ui/app/components/dropdowns/network-dropdown.js b/ui/app/components/dropdowns/network-dropdown.js
index 0908faf01..dfaa6b22c 100644
--- a/ui/app/components/dropdowns/network-dropdown.js
+++ b/ui/app/components/dropdowns/network-dropdown.js
@@ -6,6 +6,16 @@ const actions = require('../../actions')
const Dropdown = require('./components/dropdown').Dropdown
const DropdownMenuItem = require('./components/dropdown').DropdownMenuItem
const NetworkDropdownIcon = require('./components/network-dropdown-icon')
+const R = require('ramda')
+
+// classes from nodes of the toggle element.
+const notToggleElementClassnames = [
+ 'menu-icon',
+ 'network-name',
+ 'network-indicator',
+ 'network-caret',
+ 'network-component',
+]
function mapStateToProps (state) {
return {
@@ -32,8 +42,8 @@ function mapDispatchToProps (dispatch) {
showConfigPage: () => {
dispatch(actions.showConfigPage())
},
- showNetworkDropdown: () => { dispatch(actions.showNetworkDropdown()) },
- hideNetworkDropdown: () => { dispatch(actions.hideNetworkDropdown()) },
+ showNetworkDropdown: () => dispatch(actions.showNetworkDropdown()),
+ hideNetworkDropdown: () => dispatch(actions.hideNetworkDropdown()),
}
}
@@ -59,18 +69,13 @@ NetworkDropdown.prototype.render = function () {
}
return h(Dropdown, {
- useCssTransition: true,
isOpen,
onClickOutside: (event) => {
const { classList } = event.target
- const isNotToggleElement = [
- classList.contains('menu-icon'),
- classList.contains('network-name'),
- classList.contains('network-indicator'),
- ].filter(bool => bool).length === 0
- // classes from three constituent nodes of the toggle element
-
- if (isNotToggleElement) {
+ const isInClassList = className => classList.contains(className)
+ const notToggleElementIndex = R.findIndex(isInClassList)(notToggleElementClassnames)
+
+ if (notToggleElementIndex === -1) {
this.props.hideNetworkDropdown()
}
},