aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/containers/selected_asset_button.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/instant/src/containers/selected_asset_button.tsx')
-rw-r--r--packages/instant/src/containers/selected_asset_button.tsx33
1 files changed, 33 insertions, 0 deletions
diff --git a/packages/instant/src/containers/selected_asset_button.tsx b/packages/instant/src/containers/selected_asset_button.tsx
new file mode 100644
index 000000000..d6e7303dd
--- /dev/null
+++ b/packages/instant/src/containers/selected_asset_button.tsx
@@ -0,0 +1,33 @@
+import { AssetBuyer, BuyQuote } from '@0x/asset-buyer';
+import * as _ from 'lodash';
+import * as React from 'react';
+import { connect } from 'react-redux';
+import { Dispatch } from 'redux';
+
+import { State } from '../redux/reducer';
+import { AsyncProcessState } from '../types';
+
+import { SelectedAssetBuyButton } from './selected_asset_buy_button';
+import { SelectedAssetRetryButton } from './selected_asset_retry_button';
+
+interface ConnectedState {
+ buyOrderState: AsyncProcessState;
+}
+export interface SelectedAssetButtonProps {}
+const mapStateToProps = (state: State, _ownProps: SelectedAssetButtonProps): ConnectedState => ({
+ buyOrderState: state.buyOrderState,
+});
+
+const SelectedAssetButtonPresentationComponent: React.StatelessComponent<{
+ buyOrderState: AsyncProcessState;
+}> = props => {
+ if (props.buyOrderState === AsyncProcessState.FAILURE) {
+ return <SelectedAssetRetryButton />;
+ }
+
+ return <SelectedAssetBuyButton />;
+};
+
+export const SelectedAssetButton: React.ComponentClass<SelectedAssetButtonProps> = connect(mapStateToProps)(
+ SelectedAssetButtonPresentationComponent,
+);