diff options
Diffstat (limited to 'ui/app/components')
-rw-r--r-- | ui/app/components/account-menu/index.js | 56 | ||||
-rw-r--r-- | ui/app/components/dropdowns/components/menu.js | 44 |
2 files changed, 100 insertions, 0 deletions
diff --git a/ui/app/components/account-menu/index.js b/ui/app/components/account-menu/index.js new file mode 100644 index 000000000..7dc3d10a5 --- /dev/null +++ b/ui/app/components/account-menu/index.js @@ -0,0 +1,56 @@ +const inherits = require('util').inherits +const Component = require('react').Component +const connect = require('react-redux').connect +const h = require('react-hyperscript') +const actions = require('../../actions') +const { Menu, Item, Divider } = require('../dropdowns/components/menu') + +module.exports = connect(mapStateToProps, mapDispatchToProps)(AccountMenu) + +inherits(AccountMenu, Component) +function AccountMenu () { Component.call(this) } + +function mapStateToProps (state) { + return { + selectedAddress: state.metamask.selectedAddress, + } +} + +function mapDispatchToProps () { + return {} +} + +AccountMenu.prototype.render = function () { + return h(Menu, { className: 'account-menu' }, [ + h(Item, { className: 'account-menu__header' }, [ + 'My Accounts', + h('button.account-menu__logout-button', 'Log out'), + ]), + h(Divider), + h(Item, { text: 'hi' }), + h(Divider), + h(Item, { + onClick: true, + icon: h('img', { src: 'images/plus-btn-white.svg' }), + text: 'Create Account', + }), + h(Item, { + onClick: true, + icon: h('img', { src: 'images/import-account.svg' }), + text: 'Import Account', + }), + h(Divider), + h(Item, { + onClick: true, + icon: h('img', { src: 'images/mm-info-icon.svg' }), + text: 'Info & Help', + }), + h(Item, { + onClick: true, + icon: h('img', { src: 'images/settings.svg' }), + text: 'Settings', + }), + ]) +} + + diff --git a/ui/app/components/dropdowns/components/menu.js b/ui/app/components/dropdowns/components/menu.js new file mode 100644 index 000000000..0cbe0f342 --- /dev/null +++ b/ui/app/components/dropdowns/components/menu.js @@ -0,0 +1,44 @@ +const inherits = require('util').inherits +const Component = require('react').Component +const h = require('react-hyperscript') + +inherits(Menu, Component) +function Menu () { Component.call(this) } + +Menu.prototype.render = function () { + const { className = '', children, isShowing } = this.props + return isShowing + ? h('div', { className: `menu ${className}` }, children) + : h('noscript') +} + +inherits(Item, Component) +function Item () { Component.call(this) } + +Item.prototype.render = function () { + const { + icon, + children, + text, + className = '', + onClick, + } = this.props + const itemClassName = `menu__item ${className} ${onClick ? 'menu__item--clickable' : ''}` + const iconComponent = icon ? h('div.menu__item__icon', [icon]) : null + const textComponent = text ? h('div.menu__item__text', text) : null + + return children + ? h('div', { className: itemClassName }, children) + : h('div.menu__item', { className: itemClassName }, [ iconComponent, textComponent ] + .filter(d => Boolean(d)) + ) +} + +inherits(Divider, Component) +function Divider () { Component.call(this) } + +Divider.prototype.render = function () { + return h('div.menu__divider') +} + +module.exports = { Menu, Item, Divider } |