From 71d6463984f040b2aa495a13429f6ea3505defaf Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 9 Oct 2017 20:47:52 -0230 Subject: Refactor 'rendersingleidentity' to a stand alone account-list-item component. --- ui/app/components/send/account-list-item.js | 51 +++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 ui/app/components/send/account-list-item.js (limited to 'ui/app/components/send/account-list-item.js') diff --git a/ui/app/components/send/account-list-item.js b/ui/app/components/send/account-list-item.js new file mode 100644 index 000000000..b11527d95 --- /dev/null +++ b/ui/app/components/send/account-list-item.js @@ -0,0 +1,51 @@ +const Component = require('react').Component +const h = require('react-hyperscript') +const inherits = require('util').inherits +const connect = require('react-redux').connect +const Identicon = require('../identicon') + +inherits(AccountListItem, Component) +function AccountListItem () { + Component.call(this) +} + +module.exports = AccountListItem + +AccountListItem.prototype.render = function () { + const { + account, + handleClick, + icon = null, + } = this.props + + const { identity, balancesToRender } = account + const { name, address } = identity + const { primary, secondary } = balancesToRender + + return h('div.account-list-item', { + onClick: () => handleClick(identity), + }, [ + + h('div.account-list-item__top-row', {}, [ + + h( + Identicon, + { + address, + diameter: 18, + className: 'account-list-item__identicon', + }, + ), + + h('div.account-list-item__account-name', {}, name), + + icon && h('div.account-list-item__icon', [icon]), + + ]), + + h('div.account-list-item__account-primary-balance', {}, primary), + + h('div.account-list-item__account-secondary-balance', {}, secondary), + + ]) +} \ No newline at end of file -- cgit