diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-06-19 07:55:52 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-06-19 08:08:44 +0800 |
commit | f97e605bf6769a17d0352219f5fb1133f7cb2430 (patch) | |
tree | 102f382273c38facd8ba8448b6cbfba2329623b4 /packages/website/ts/components/ui | |
parent | 49f5495c459f194f3cab6ff24526da924bd64a53 (diff) | |
download | dexon-sol-tools-f97e605bf6769a17d0352219f5fb1133f7cb2430.tar dexon-sol-tools-f97e605bf6769a17d0352219f5fb1133f7cb2430.tar.gz dexon-sol-tools-f97e605bf6769a17d0352219f5fb1133f7cb2430.tar.bz2 dexon-sol-tools-f97e605bf6769a17d0352219f5fb1133f7cb2430.tar.lz dexon-sol-tools-f97e605bf6769a17d0352219f5fb1133f7cb2430.tar.xz dexon-sol-tools-f97e605bf6769a17d0352219f5fb1133f7cb2430.tar.zst dexon-sol-tools-f97e605bf6769a17d0352219f5fb1133f7cb2430.zip |
Consolidate account state messaging logic
Diffstat (limited to 'packages/website/ts/components/ui')
-rw-r--r-- | packages/website/ts/components/ui/identicon.tsx | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/packages/website/ts/components/ui/identicon.tsx b/packages/website/ts/components/ui/identicon.tsx index 83c86a144..6a9b94e5b 100644 --- a/packages/website/ts/components/ui/identicon.tsx +++ b/packages/website/ts/components/ui/identicon.tsx @@ -1,7 +1,8 @@ import blockies = require('blockies'); import * as _ from 'lodash'; import * as React from 'react'; -import { constants } from 'ts/utils/constants'; + +import { colors } from 'ts/style/colors'; interface IdenticonProps { address: string; @@ -16,14 +17,9 @@ export class Identicon extends React.Component<IdenticonProps, IdenticonState> { style: {}, }; public render(): React.ReactNode { - let address = this.props.address; - if (_.isEmpty(address)) { - address = constants.NULL_ADDRESS; - } + const address = this.props.address; const diameter = this.props.diameter; - const icon = blockies({ - seed: address.toLowerCase(), - }); + const radius = diameter / 2; return ( <div className="circle mx-auto relative transitionFix" @@ -34,14 +30,22 @@ export class Identicon extends React.Component<IdenticonProps, IdenticonState> { ...this.props.style, }} > - <img - src={icon.toDataURL()} - style={{ - width: diameter, - height: diameter, - imageRendering: 'pixelated', - }} - /> + {!_.isEmpty(address) ? ( + <img + src={blockies({ + seed: address.toLowerCase(), + }).toDataURL()} + style={{ + width: diameter, + height: diameter, + imageRendering: 'pixelated', + }} + /> + ) : ( + <svg height={diameter} width={diameter}> + <circle cx={radius} cy={radius} r={radius} fill={colors.grey200} /> + </svg> + )} </div> ); } |