aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/components
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-11-01 10:50:37 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-11-01 10:50:37 +0800
commit3f918622bcce21ba104e0f13e71247796345ab0f (patch)
treefe0e6dd540871a17abe1274fa2c7e4a1ad40d90b /packages/instant/src/components
parent6091ee732d208eaf9889087b8308dfd0427b9be5 (diff)
downloaddexon-sol-tools-3f918622bcce21ba104e0f13e71247796345ab0f.tar
dexon-sol-tools-3f918622bcce21ba104e0f13e71247796345ab0f.tar.gz
dexon-sol-tools-3f918622bcce21ba104e0f13e71247796345ab0f.tar.bz2
dexon-sol-tools-3f918622bcce21ba104e0f13e71247796345ab0f.tar.lz
dexon-sol-tools-3f918622bcce21ba104e0f13e71247796345ab0f.tar.xz
dexon-sol-tools-3f918622bcce21ba104e0f13e71247796345ab0f.tar.zst
dexon-sol-tools-3f918622bcce21ba104e0f13e71247796345ab0f.zip
feat: implement basic erc20 token selector
Diffstat (limited to 'packages/instant/src/components')
-rw-r--r--packages/instant/src/components/erc20_token_selector.tsx34
-rw-r--r--packages/instant/src/components/zero_ex_instant_container.tsx3
2 files changed, 36 insertions, 1 deletions
diff --git a/packages/instant/src/components/erc20_token_selector.tsx b/packages/instant/src/components/erc20_token_selector.tsx
new file mode 100644
index 000000000..a98176e9b
--- /dev/null
+++ b/packages/instant/src/components/erc20_token_selector.tsx
@@ -0,0 +1,34 @@
+import * as _ from 'lodash';
+import * as React from 'react';
+
+import { ERC20Asset } from '../types';
+
+import { Button, Container } from './ui';
+
+export interface ERC20TokenSelectorProps {
+ tokens: ERC20Asset[];
+ onTokenSelect: (token: ERC20Asset) => void;
+}
+
+export const ERC20TokenSelector: React.StatelessComponent<ERC20TokenSelectorProps> = ({ tokens, onTokenSelect }) => (
+ <Container>{_.map(tokens, token => <TokenSelectorRow token={token} onClick={onTokenSelect} />)}</Container>
+);
+
+interface TokenSelectorRowProps {
+ token: ERC20Asset;
+ onClick: (token: ERC20Asset) => void;
+}
+
+class TokenSelectorRow extends React.Component<TokenSelectorRowProps> {
+ public render(): React.ReactNode {
+ const { token } = this.props;
+ return (
+ <Container>
+ <Button onClick={this._handleClick}>Select {token.metaData.symbol}</Button>
+ </Container>
+ );
+ }
+ private readonly _handleClick = (): void => {
+ this.props.onClick(this.props.token);
+ };
+}
diff --git a/packages/instant/src/components/zero_ex_instant_container.tsx b/packages/instant/src/components/zero_ex_instant_container.tsx
index 009ad9b2a..765ff7e3d 100644
--- a/packages/instant/src/components/zero_ex_instant_container.tsx
+++ b/packages/instant/src/components/zero_ex_instant_container.tsx
@@ -1,5 +1,6 @@
import * as React from 'react';
+import { AvailableERC20TokenSelector } from '../containers/available_erc20_token_selector';
import { LatestBuyQuoteOrderDetails } from '../containers/latest_buy_quote_order_details';
import { LatestError } from '../containers/latest_error';
import { SelectedAssetBuyOrderStateButtons } from '../containers/selected_asset_buy_order_state_buttons';
@@ -45,7 +46,7 @@ export class ZeroExInstantContainer extends React.Component<ZeroExInstantContain
animationState={this.state.tokenSelectionPanelAnimationState}
onClose={this._handlePanelClose}
>
- Select Your Token
+ <AvailableERC20TokenSelector />
</SlidingPanel>
</Container>
</Container>