1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-28 05:12:18 +01:00
metamask-extension/ui/app/components/dropdowns/token-menu-dropdown.js

52 lines
1.3 KiB
JavaScript
Raw Normal View History

2017-09-29 12:10:50 +02:00
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
2017-09-29 21:03:29 +02:00
const connect = require('react-redux').connect
const actions = require('../../actions')
module.exports = connect(null, mapDispatchToProps)(TokenMenuDropdown)
function mapDispatchToProps (dispatch) {
return {
showHideTokenConfirmationModal: (token) => {
dispatch(actions.showModal({ name: 'HIDE_TOKEN_CONFIRMATION', token }))
}
}
}
2017-09-29 12:10:50 +02:00
inherits(TokenMenuDropdown, Component)
function TokenMenuDropdown () {
Component.call(this)
this.onClose = this.onClose.bind(this)
}
TokenMenuDropdown.prototype.onClose = function (e) {
e.stopPropagation()
this.props.onClose()
}
TokenMenuDropdown.prototype.render = function () {
2017-09-29 21:03:29 +02:00
const { showHideTokenConfirmationModal } = this.props
2017-09-29 12:10:50 +02:00
return h('div.token-menu-dropdown', {}, [
h('div.token-menu-dropdown__close-area', {
onClick: this.onClose,
}),
h('div.token-menu-dropdown__container', {}, [
h('div.token-menu-dropdown__options', {}, [
h('div.token-menu-dropdown__option', {
onClick: (e) => {
e.stopPropagation()
2017-09-29 21:03:29 +02:00
showHideTokenConfirmationModal(this.props.token)
this.props.onClose()
2017-09-29 12:10:50 +02:00
},
}, 'Hide Token')
]),
]),
])
}