From fa7bd072d064d1c79c8e84bc42463491ebbad33f Mon Sep 17 00:00:00 2001
From: fragosti <francesco.agosti93@gmail.com>
Date: Fri, 9 Nov 2018 13:19:59 -0800
Subject: feat: refactor progress bar code to expose static progress bar

---
 .../src/components/zero_ex_instant_container.tsx   | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

(limited to 'packages/instant/src/components/zero_ex_instant_container.tsx')

diff --git a/packages/instant/src/components/zero_ex_instant_container.tsx b/packages/instant/src/components/zero_ex_instant_container.tsx
index b5f974cbe..f96174b63 100644
--- a/packages/instant/src/components/zero_ex_instant_container.tsx
+++ b/packages/instant/src/components/zero_ex_instant_container.tsx
@@ -9,14 +9,16 @@ import { SelectedAssetBuyOrderStateButtons } from '../containers/selected_asset_
 import { SelectedAssetInstantHeading } from '../containers/selected_asset_instant_heading';
 import { ColorOption } from '../style/theme';
 import { zIndex } from '../style/z_index';
-import { SlideAnimationState } from '../types';
+import { OrderProcessState, SlideAnimationState } from '../types';
 
 import { CSSReset } from './css_reset';
 import { SlidingPanel } from './sliding_panel';
 import { Container } from './ui/container';
 import { Flex } from './ui/flex';
 
-export interface ZeroExInstantContainerProps {}
+export interface ZeroExInstantContainerProps {
+    orderProcessState: OrderProcessState;
+}
 export interface ZeroExInstantContainerState {
     tokenSelectionPanelAnimationState: SlideAnimationState;
 }
@@ -48,7 +50,7 @@ export class ZeroExInstantContainer extends React.Component<ZeroExInstantContain
                     >
                         <Flex direction="column" justify="flex-start" height="100%">
                             <SelectedAssetInstantHeading onSelectAssetClick={this._handleSymbolClick} />
-                            <SelectedAssetBuyOrderProgress />
+                            {this._renderPaymentMethodOrBuyOrderProgress()}
                             <LatestBuyQuoteOrderDetails />
                             <Container padding="20px" width="100%">
                                 <SelectedAssetBuyOrderStateButtons />
@@ -76,4 +78,18 @@ export class ZeroExInstantContainer extends React.Component<ZeroExInstantContain
             tokenSelectionPanelAnimationState: 'slidOut',
         });
     };
+    private readonly _renderPaymentMethodOrBuyOrderProgress = (): React.ReactNode => {
+        const { orderProcessState } = this.props;
+        if (
+            orderProcessState === OrderProcessState.Processing ||
+            orderProcessState === OrderProcessState.Success ||
+            orderProcessState === OrderProcessState.Failure
+        ) {
+            return <SelectedAssetBuyOrderProgress />;
+        }
+        if (orderProcessState === OrderProcessState.None) {
+            return <SelectedAssetBuyOrderProgress />;
+        }
+        return null;
+    };
 }
-- 
cgit 

