diff options
author | Chi Kei Chan <chikeichan@gmail.com> | 2017-10-13 14:10:58 +0800 |
---|---|---|
committer | Chi Kei Chan <chikeichan@gmail.com> | 2017-10-13 14:11:01 +0800 |
commit | 81f62a7443d47461b5f9b20f442392562458c79a (patch) | |
tree | b4c283caec9e6409b69422c36f1010e8f2592b37 /ui/app/components/dropdowns | |
parent | 57179d2b05a4efae06c2375e01e9a01a5519543b (diff) | |
download | tangerine-wallet-browser-81f62a7443d47461b5f9b20f442392562458c79a.tar tangerine-wallet-browser-81f62a7443d47461b5f9b20f442392562458c79a.tar.gz tangerine-wallet-browser-81f62a7443d47461b5f9b20f442392562458c79a.tar.bz2 tangerine-wallet-browser-81f62a7443d47461b5f9b20f442392562458c79a.tar.lz tangerine-wallet-browser-81f62a7443d47461b5f9b20f442392562458c79a.tar.xz tangerine-wallet-browser-81f62a7443d47461b5f9b20f442392562458c79a.tar.zst tangerine-wallet-browser-81f62a7443d47461b5f9b20f442392562458c79a.zip |
Adding Account Dropdown V2
Diffstat (limited to 'ui/app/components/dropdowns')
-rw-r--r-- | ui/app/components/dropdowns/components/menu.js | 44 |
1 files changed, 44 insertions, 0 deletions
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 } |