diff options
author | Esteban MIno <efmino@uc.cl> | 2018-08-15 07:08:12 +0800 |
---|---|---|
committer | Esteban MIno <efmino@uc.cl> | 2018-08-15 07:08:12 +0800 |
commit | a4c3f6b65c9a25da0319b9077d830c23f729b32f (patch) | |
tree | 39d272a7364f97d6f676a102e97f65d0195c450c /ui/app/components/identicon.js | |
parent | 8f5b80a0fe13c53a602a5b2883ae1cdfba0123e1 (diff) | |
download | tangerine-wallet-browser-a4c3f6b65c9a25da0319b9077d830c23f729b32f.tar.gz tangerine-wallet-browser-a4c3f6b65c9a25da0319b9077d830c23f729b32f.tar.zst tangerine-wallet-browser-a4c3f6b65c9a25da0319b9077d830c23f729b32f.zip |
add support for images base64 and urls on new ui
Diffstat (limited to 'ui/app/components/identicon.js')
-rw-r--r-- | ui/app/components/identicon.js | 65 |
1 files changed, 36 insertions, 29 deletions
diff --git a/ui/app/components/identicon.js b/ui/app/components/identicon.js index 424048745..eadd6d5a2 100644 --- a/ui/app/components/identicon.js +++ b/ui/app/components/identicon.js @@ -26,36 +26,43 @@ function mapStateToProps (state) { IdenticonComponent.prototype.render = function () { var props = this.props - const { className = '', address } = props + const { className = '', address, imageUrl } = props var diameter = props.diameter || this.defaultDiameter - - return address - ? ( - h('div', { - className: `${className} identicon`, - key: 'identicon-' + address, - style: { - display: 'flex', - flexShrink: 0, - alignItems: 'center', - justifyContent: 'center', - height: diameter, - width: diameter, - borderRadius: diameter / 2, - overflow: 'hidden', - }, - }) - ) - : ( - h('img.balance-icon', { - src: './images/eth_logo.svg', - style: { - height: diameter, - width: diameter, - borderRadius: diameter / 2, - }, - }) - ) + // for tokens added with `watchToken` we need to render the given image + if (imageUrl) { + return h('img.balance-icon', { + src: imageUrl, + style: { + height: diameter, + width: diameter, + borderRadius: diameter / 2, + }, + }) + } else if (address) { + return h('div', { + className: `${className} identicon`, + key: 'identicon-' + address, + style: { + display: 'flex', + flexShrink: 0, + alignItems: 'center', + justifyContent: 'center', + height: diameter, + width: diameter, + borderRadius: diameter / 2, + overflow: 'hidden', + }, + }) + } else { + return h('img.balance-icon', { + src: './images/eth_logo.svg', + style: { + height: diameter, + width: diameter, + borderRadius: diameter / 2, + }, + }) + } } IdenticonComponent.prototype.componentDidMount = function () { |