aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/containers
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-11-02 04:16:48 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-11-02 04:16:48 +0800
commitbda9d4c1b099fc4db05d34a1d8dc0543a68413b8 (patch)
treefaee82d0bca11cc610ee7ac8d0c4c298722208b4 /packages/instant/src/containers
parentb55ba3a31823699fa2460fad6fd22b913c38c946 (diff)
downloaddexon-sol-tools-bda9d4c1b099fc4db05d34a1d8dc0543a68413b8.tar
dexon-sol-tools-bda9d4c1b099fc4db05d34a1d8dc0543a68413b8.tar.gz
dexon-sol-tools-bda9d4c1b099fc4db05d34a1d8dc0543a68413b8.tar.bz2
dexon-sol-tools-bda9d4c1b099fc4db05d34a1d8dc0543a68413b8.tar.lz
dexon-sol-tools-bda9d4c1b099fc4db05d34a1d8dc0543a68413b8.tar.xz
dexon-sol-tools-bda9d4c1b099fc4db05d34a1d8dc0543a68413b8.tar.zst
dexon-sol-tools-bda9d4c1b099fc4db05d34a1d8dc0543a68413b8.zip
feat: auto-close panel when a token is selected
Diffstat (limited to 'packages/instant/src/containers')
-rw-r--r--packages/instant/src/containers/available_erc20_token_selector.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/packages/instant/src/containers/available_erc20_token_selector.ts b/packages/instant/src/containers/available_erc20_token_selector.ts
index e8bacdba0..bb194cd6b 100644
--- a/packages/instant/src/containers/available_erc20_token_selector.ts
+++ b/packages/instant/src/containers/available_erc20_token_selector.ts
@@ -1,3 +1,4 @@
+import * as _ from 'lodash';
import * as React from 'react';
import { connect } from 'react-redux';
import { Dispatch } from 'redux';
@@ -9,7 +10,9 @@ import { assetUtils } from '../util/asset';
import { ERC20TokenSelector } from '../components/erc20_token_selector';
import { Action, actions } from '../redux/actions';
-export interface AvailableERC20TokenSelectorProps {}
+export interface AvailableERC20TokenSelectorProps {
+ onTokenSelect?: (token: ERC20Asset) => void;
+}
interface ConnectedState {
tokens: ERC20Asset[];
@@ -27,7 +30,12 @@ const mapDispatchToProps = (
dispatch: Dispatch<Action>,
ownProps: AvailableERC20TokenSelectorProps,
): ConnectedDispatch => ({
- onTokenSelect: (token: ERC20Asset) => dispatch(actions.updateSelectedAsset(token)),
+ onTokenSelect: (token: ERC20Asset) => {
+ if (ownProps.onTokenSelect) {
+ ownProps.onTokenSelect(token);
+ }
+ dispatch(actions.updateSelectedAsset(token));
+ },
});
export const AvailableERC20TokenSelector: React.ComponentClass<AvailableERC20TokenSelectorProps> = connect(