aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/identicon.js
diff options
context:
space:
mode:
authorJason Clark <jason@longview.tech>2017-11-25 04:48:56 +0800
committerJason Clark <jason@longview.tech>2017-11-25 04:48:56 +0800
commitdc7bd3c62897edfb642f215a71fbf7dd93faa350 (patch)
tree5064184b75554d0ba592c7f4afb4d28feb4e1573 /ui/app/components/identicon.js
parentfc46a16a329df296cb565e3a0b04f268d2aeceb5 (diff)
downloadtangerine-wallet-browser-dc7bd3c62897edfb642f215a71fbf7dd93faa350.tar
tangerine-wallet-browser-dc7bd3c62897edfb642f215a71fbf7dd93faa350.tar.gz
tangerine-wallet-browser-dc7bd3c62897edfb642f215a71fbf7dd93faa350.tar.bz2
tangerine-wallet-browser-dc7bd3c62897edfb642f215a71fbf7dd93faa350.tar.lz
tangerine-wallet-browser-dc7bd3c62897edfb642f215a71fbf7dd93faa350.tar.xz
tangerine-wallet-browser-dc7bd3c62897edfb642f215a71fbf7dd93faa350.tar.zst
tangerine-wallet-browser-dc7bd3c62897edfb642f215a71fbf7dd93faa350.zip
incremental commit of working blockie component
Diffstat (limited to 'ui/app/components/identicon.js')
-rw-r--r--ui/app/components/identicon.js41
1 files changed, 26 insertions, 15 deletions
diff --git a/ui/app/components/identicon.js b/ui/app/components/identicon.js
index 63f3087a4..9e9b82aae 100644
--- a/ui/app/components/identicon.js
+++ b/ui/app/components/identicon.js
@@ -1,14 +1,15 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
+const connect = require('react-redux').connect
const isNode = require('detect-node')
const findDOMNode = require('react-dom').findDOMNode
const jazzicon = require('jazzicon')
-const blockies = require('blockies')
+const BlockiesIdenticon = require('./blockies/blockies-component')
const iconFactoryGen = require('../../lib/icon-factory')
const iconFactory = iconFactoryGen(jazzicon)
-module.exports = IdenticonComponent
+module.exports = connect(mapStateToProps)(IdenticonComponent)
inherits(IdenticonComponent, Component)
function IdenticonComponent () {
@@ -17,6 +18,12 @@ function IdenticonComponent () {
this.defaultDiameter = 46
}
+function mapStateToProps (state) {
+ return {
+ useBlockie: state.metamask.useBlockie
+ }
+}
+
IdenticonComponent.prototype.render = function () {
var props = this.props
const { className = '', address, useBlockie } = props
@@ -24,19 +31,23 @@ IdenticonComponent.prototype.render = function () {
return address
? (
- h('div', {
- className: `${className} identicon`,
- key: 'identicon-' + address,
- style: {
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- height: diameter,
- width: diameter,
- borderRadius: diameter / 2,
- overflow: 'hidden',
- },
- })
+ useBlockie
+ ? h(BlockiesIdenticon, {
+ seed: address,
+ })
+ : h('div', {
+ className: `${className} identicon`,
+ key: 'identicon-' + address,
+ style: {
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ height: diameter,
+ width: diameter,
+ borderRadius: diameter / 2,
+ overflow: 'hidden',
+ },
+ })
)
: (
h('img.balance-icon', {