aboutsummaryrefslogtreecommitdiffstats
path: root/old-ui/app/components/mini-account-panel.js
diff options
context:
space:
mode:
authorChi Kei Chan <chikeichan@gmail.com>2017-12-08 01:54:37 +0800
committerGitHub <noreply@github.com>2017-12-08 01:54:37 +0800
commit41d281a52714ad432b115d94a272156d51cd7bad (patch)
tree36c1a9ad91600f48496157b45c9fa3019206467d /old-ui/app/components/mini-account-panel.js
parent7dba114feb428f7f2f78fee5611377b04bff5be6 (diff)
parente0d0e19c925224bddf56a4088fb9c402d995d79f (diff)
downloadtangerine-wallet-browser-41d281a52714ad432b115d94a272156d51cd7bad.tar
tangerine-wallet-browser-41d281a52714ad432b115d94a272156d51cd7bad.tar.gz
tangerine-wallet-browser-41d281a52714ad432b115d94a272156d51cd7bad.tar.bz2
tangerine-wallet-browser-41d281a52714ad432b115d94a272156d51cd7bad.tar.lz
tangerine-wallet-browser-41d281a52714ad432b115d94a272156d51cd7bad.tar.xz
tangerine-wallet-browser-41d281a52714ad432b115d94a272156d51cd7bad.tar.zst
tangerine-wallet-browser-41d281a52714ad432b115d94a272156d51cd7bad.zip
Merge branch 'NewUI-flat' into cb-372
Diffstat (limited to 'old-ui/app/components/mini-account-panel.js')
-rw-r--r--old-ui/app/components/mini-account-panel.js74
1 files changed, 74 insertions, 0 deletions
diff --git a/old-ui/app/components/mini-account-panel.js b/old-ui/app/components/mini-account-panel.js
new file mode 100644
index 000000000..c09cf5b7a
--- /dev/null
+++ b/old-ui/app/components/mini-account-panel.js
@@ -0,0 +1,74 @@
+const inherits = require('util').inherits
+const Component = require('react').Component
+const h = require('react-hyperscript')
+const Identicon = require('./identicon')
+
+module.exports = AccountPanel
+
+
+inherits(AccountPanel, Component)
+function AccountPanel () {
+ Component.call(this)
+}
+
+AccountPanel.prototype.render = function () {
+ var props = this.props
+ var picOrder = props.picOrder || 'left'
+ const { imageSeed } = props
+
+ return (
+
+ h('.identity-panel.flex-row.flex-left', {
+ style: {
+ cursor: props.onClick ? 'pointer' : undefined,
+ },
+ onClick: props.onClick,
+ }, [
+
+ this.genIcon(imageSeed, picOrder),
+
+ h('div.flex-column.flex-justify-center', {
+ style: {
+ lineHeight: '15px',
+ order: 2,
+ display: 'flex',
+ alignItems: picOrder === 'left' ? 'flex-begin' : 'flex-end',
+ },
+ }, this.props.children),
+ ])
+ )
+}
+
+AccountPanel.prototype.genIcon = function (seed, picOrder) {
+ const props = this.props
+
+ // When there is no seed value, this is a contract creation.
+ // We then show the contract icon.
+ if (!seed) {
+ return h('.identicon-wrapper.flex-column.select-none', {
+ style: {
+ order: picOrder === 'left' ? 1 : 3,
+ },
+ }, [
+ h('i.fa.fa-file-text-o.fa-lg', {
+ style: {
+ fontSize: '42px',
+ transform: 'translate(0px, -16px)',
+ },
+ }),
+ ])
+ }
+
+ // If there was a seed, we return an identicon for that address.
+ return h('.identicon-wrapper.flex-column.select-none', {
+ style: {
+ order: picOrder === 'left' ? 1 : 3,
+ },
+ }, [
+ h(Identicon, {
+ address: seed,
+ imageify: props.imageifyIdenticons,
+ }),
+ ])
+}
+