aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components/ui/token_icon.tsx
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-05-22 07:35:49 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-05-22 12:25:42 +0800
commit26370da13d7bed06d59efeba0a4921387b874e06 (patch)
treebc99e7a69e0e7ee22e10d47e27beaa1d270cf950 /packages/website/ts/components/ui/token_icon.tsx
parentd460c0e8b9c6f4081803fff4e2d2347be8cd5ce3 (diff)
downloaddexon-0x-contracts-26370da13d7bed06d59efeba0a4921387b874e06.tar.gz
dexon-0x-contracts-26370da13d7bed06d59efeba0a4921387b874e06.tar.zst
dexon-0x-contracts-26370da13d7bed06d59efeba0a4921387b874e06.zip
Rewrite balance rows using flex box
Diffstat (limited to 'packages/website/ts/components/ui/token_icon.tsx')
-rw-r--r--packages/website/ts/components/ui/token_icon.tsx25
1 files changed, 16 insertions, 9 deletions
diff --git a/packages/website/ts/components/ui/token_icon.tsx b/packages/website/ts/components/ui/token_icon.tsx
index a9ad567ef..0875cc56b 100644
--- a/packages/website/ts/components/ui/token_icon.tsx
+++ b/packages/website/ts/components/ui/token_icon.tsx
@@ -6,6 +6,7 @@ import { Token } from 'ts/types';
interface TokenIconProps {
token: Token;
diameter: number;
+ link?: string;
}
interface TokenIconState {}
@@ -14,14 +15,20 @@ export class TokenIcon extends React.Component<TokenIconProps, TokenIconState> {
public render(): React.ReactNode {
const token = this.props.token;
const diameter = this.props.diameter;
- return (
- <div>
- {token.isRegistered && !_.isUndefined(token.iconUrl) ? (
- <img style={{ width: diameter, height: diameter }} src={token.iconUrl} />
- ) : (
- <Identicon address={token.address} diameter={diameter} />
- )}
- </div>
- );
+ const icon =
+ token.isRegistered && !_.isUndefined(token.iconUrl) ? (
+ <img style={{ width: diameter, height: diameter }} src={token.iconUrl} />
+ ) : (
+ <Identicon address={token.address} diameter={diameter} />
+ );
+ if (_.isEmpty(this.props.link)) {
+ return icon;
+ } else {
+ return (
+ <a href={this.props.link} target="_blank" style={{ textDecoration: 'none' }}>
+ {icon}
+ </a>
+ );
+ }
}
}