diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-04-04 02:12:55 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-04-05 03:09:03 +0800 |
commit | 250d97a7c4eacceb8d6be0b23a640e22cec5a43c (patch) | |
tree | 94632f5dd234da01ad65d2856ba3a012aef32a88 /packages/website/ts/components/relayer_index/relayer_top_tokens.tsx | |
parent | 674e56cea69fe96ddd0071d3c4c5b5ea8ae299bf (diff) | |
download | dexon-sol-tools-250d97a7c4eacceb8d6be0b23a640e22cec5a43c.tar dexon-sol-tools-250d97a7c4eacceb8d6be0b23a640e22cec5a43c.tar.gz dexon-sol-tools-250d97a7c4eacceb8d6be0b23a640e22cec5a43c.tar.bz2 dexon-sol-tools-250d97a7c4eacceb8d6be0b23a640e22cec5a43c.tar.lz dexon-sol-tools-250d97a7c4eacceb8d6be0b23a640e22cec5a43c.tar.xz dexon-sol-tools-250d97a7c4eacceb8d6be0b23a640e22cec5a43c.tar.zst dexon-sol-tools-250d97a7c4eacceb8d6be0b23a640e22cec5a43c.zip |
Implement initial relayer grid
Diffstat (limited to 'packages/website/ts/components/relayer_index/relayer_top_tokens.tsx')
-rw-r--r-- | packages/website/ts/components/relayer_index/relayer_top_tokens.tsx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/packages/website/ts/components/relayer_index/relayer_top_tokens.tsx b/packages/website/ts/components/relayer_index/relayer_top_tokens.tsx new file mode 100644 index 000000000..233590b78 --- /dev/null +++ b/packages/website/ts/components/relayer_index/relayer_top_tokens.tsx @@ -0,0 +1,46 @@ +import { colors, EtherscanLinkSuffixes, Styles, utils as sharedUtils } from '@0xproject/react-shared'; +import * as _ from 'lodash'; +import * as React from 'react'; + +import { TokenIcon } from 'ts/components/ui/token_icon'; +import { Token } from 'ts/types'; + +export interface TopTokensProps { + tokens: Token[]; + networkId: number; +} + +const styles: Styles = { + tokenLabel: { + textDecoration: 'none', + color: colors.mediumBlue, + }, + followingTokenLabel: { + paddingLeft: 16, + }, +}; + +export const TopTokens: React.StatelessComponent<TopTokensProps> = (props: TopTokensProps) => { + return ( + <div className="flex"> + {_.map(props.tokens, (token: Token, index: number) => { + const firstItemStyle = { ...styles.tokenLabel, ...styles.followingTokenLabel }; + const style = index !== 0 ? firstItemStyle : styles.tokenLabel; + return ( + <a + key={token.address} + href={tokenLinkFromToken(token, props.networkId)} + target="_blank" + style={style} + > + {token.symbol} + </a> + ); + })} + </div> + ); +}; + +function tokenLinkFromToken(token: Token, networkId: number) { + return sharedUtils.getEtherScanLinkIfExists(token.address, networkId, EtherscanLinkSuffixes.Address); +} |