1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 19:10:22 +01:00
metamask-extension/ui/app/components/dropdowns/token-menu-dropdown.js

53 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
2018-03-16 01:29:45 +01:00
const connect = require('../../metamask-connect')
2017-09-29 21:03:29 +02:00
const actions = require('../../actions')
2018-03-15 00:31:45 +01:00
2017-09-29 21:03:29 +02:00
module.exports = connect(null, mapDispatchToProps)(TokenMenuDropdown)
function mapDispatchToProps (dispatch) {
return {
showHideTokenConfirmationModal: (token) => {
dispatch(actions.showModal({ name: 'HIDE_TOKEN_CONFIRMATION', token }))
2017-11-02 13:15:59 +01:00
},
2017-09-29 21:03:29 +02:00
}
}
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', {}, [
2017-11-02 13:15:59 +01:00
2017-09-29 12:10:50 +02:00
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
},
}, this.props.t('hideToken')),
2017-09-29 12:10:50 +02:00
]),
]),
])
}