From d43f89fa0af709b1c1616ab5cfb32b8c27e07ab6 Mon Sep 17 00:00:00 2001
From: Steve Klebanoff <steve.klebanoff@gmail.com>
Date: Tue, 23 Oct 2018 17:28:27 -0700
Subject: move buy order state to its own component

---
 .../src/components/buy_order_state_button.tsx      | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 packages/instant/src/components/buy_order_state_button.tsx

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

diff --git a/packages/instant/src/components/buy_order_state_button.tsx b/packages/instant/src/components/buy_order_state_button.tsx
new file mode 100644
index 000000000..e7641e7e7
--- /dev/null
+++ b/packages/instant/src/components/buy_order_state_button.tsx
@@ -0,0 +1,24 @@
+import * as React from 'react';
+
+import { SelectedAssetBuyButton } from '../containers/selected_asset_buy_button';
+import { SelectedAssetRetryButton } from '../containers/selected_asset_retry_button';
+
+import { AsyncProcessState } from '../types';
+
+import { SecondaryButton } from './secondary_button';
+
+export interface BuyOrderStateButtonProps {
+    buyOrderState: AsyncProcessState;
+}
+
+export const BuyOrderStateButton: React.StatelessComponent<BuyOrderStateButtonProps> = props => {
+    if (props.buyOrderState === AsyncProcessState.FAILURE) {
+        return <SelectedAssetRetryButton />;
+    } else if (props.buyOrderState === AsyncProcessState.SUCCESS) {
+        return <SecondaryButton text="Success" isDisabled={true} />;
+    } else if (props.buyOrderState === AsyncProcessState.PENDING) {
+        return <SecondaryButton text="Processing" isDisabled={true} />;
+    }
+
+    return <SelectedAssetBuyButton />;
+};
-- 
cgit v1.2.3

