diff options
author | Le Quoc Viet <vietlq85@gmail.com> | 2018-03-15 16:11:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-15 16:11:42 +0800 |
commit | 04079455e36e48433cf8055c8f1f79e1e7e18298 (patch) | |
tree | d7de2a6603b67b56abacf09bee4d2bbbfe886b8f /ui/app/components/modals/account-modal-container.js | |
parent | 5bdee96e73f65a0b369277e9c56b0afe5159e65b (diff) | |
parent | e2efc91aee64072c408ab509219dcbfb389c7609 (diff) | |
download | tangerine-wallet-browser-04079455e36e48433cf8055c8f1f79e1e7e18298.tar.gz tangerine-wallet-browser-04079455e36e48433cf8055c8f1f79e1e7e18298.tar.zst tangerine-wallet-browser-04079455e36e48433cf8055c8f1f79e1e7e18298.zip |
Merge pull request #1 from MetaMask/master
Merge from the source
Diffstat (limited to 'ui/app/components/modals/account-modal-container.js')
-rw-r--r-- | ui/app/components/modals/account-modal-container.js | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/ui/app/components/modals/account-modal-container.js b/ui/app/components/modals/account-modal-container.js new file mode 100644 index 000000000..08540aa76 --- /dev/null +++ b/ui/app/components/modals/account-modal-container.js @@ -0,0 +1,75 @@ +const Component = require('react').Component +const h = require('react-hyperscript') +const inherits = require('util').inherits +const connect = require('react-redux').connect +const actions = require('../../actions') +const { getSelectedIdentity } = require('../../selectors') +const Identicon = require('../identicon') +const t = require('../../../i18n') + +function mapStateToProps (state) { + return { + selectedIdentity: getSelectedIdentity(state), + } +} + +function mapDispatchToProps (dispatch) { + return { + hideModal: () => { + dispatch(actions.hideModal()) + }, + } +} + +inherits(AccountModalContainer, Component) +function AccountModalContainer () { + Component.call(this) +} + +module.exports = connect(mapStateToProps, mapDispatchToProps)(AccountModalContainer) + +AccountModalContainer.prototype.render = function () { + const { + selectedIdentity, + showBackButton = false, + backButtonAction, + } = this.props + let { children } = this.props + + if (children.constructor !== Array) { + children = [children] + } + + return h('div', { style: { borderRadius: '4px' }}, [ + h('div.account-modal-container', [ + + h('div', [ + + // Needs a border; requires changes to svg + h(Identicon, { + address: selectedIdentity.address, + diameter: 64, + style: {}, + }), + + ]), + + showBackButton && h('div.account-modal-back', { + onClick: backButtonAction, + }, [ + + h('i.fa.fa-angle-left.fa-lg'), + + h('span.account-modal-back__text', ' ' + t('back')), + + ]), + + h('div.account-modal-close', { + onClick: this.props.hideModal, + }), + + ...children, + + ]), + ]) +} |