From f80768cae0c2fdb71237bbdddecc67aec1c1f67f Mon Sep 17 00:00:00 2001
From: fragosti <francesco.agosti93@gmail.com>
Date: Thu, 29 Nov 2018 15:57:35 -0800
Subject: feat: add Select component and use for configurator

---
 packages/website/ts/pages/instant/configurator.tsx | 70 ++++++++++++++--------
 1 file changed, 46 insertions(+), 24 deletions(-)

(limited to 'packages/website/ts/pages/instant/configurator.tsx')

diff --git a/packages/website/ts/pages/instant/configurator.tsx b/packages/website/ts/pages/instant/configurator.tsx
index 29a3e2b1e..cf9985675 100644
--- a/packages/website/ts/pages/instant/configurator.tsx
+++ b/packages/website/ts/pages/instant/configurator.tsx
@@ -4,34 +4,56 @@ import { Container } from 'ts/components/ui/container';
 import { Text } from 'ts/components/ui/text';
 import { ActionLink } from 'ts/pages/instant/action_link';
 import { CodeDemo } from 'ts/pages/instant/code_demo';
+import { ConfigGenerator } from 'ts/pages/instant/config_generator';
 import { colors } from 'ts/style/colors';
 
+import { ZeroExInstantBaseConfig } from '../../../../instant/src/types';
+
 export interface ConfiguratorProps {
     hash: string;
 }
 
-export const Configurator = (props: ConfiguratorProps) => (
-    <Container
-        className="flex justify-center py4 px3"
-        id={props.hash}
-        backgroundColor={colors.instantTertiaryBackground}
-    >
-        <Container className="mx3">
-            <Container className="mb3">
-                <Text fontSize="20px" lineHeight="28px" fontColor={colors.white} fontWeight={500}>
-                    0x Instant Configurator
-                </Text>
-            </Container>
-            <Container height="400px" width="300px" backgroundColor="white" />
-        </Container>
-        <Container className="mx3">
-            <Container className="mb3 flex justify-between">
-                <Text fontSize="20px" lineHeight="28px" fontColor={colors.white} fontWeight={500}>
-                    Code Snippet
-                </Text>
-                <ActionLink displayText="Explore the Docs" linkSrc="/docs/instant" color={colors.grey} />
+export interface ConfiguratorState {
+    instantConfig: ZeroExInstantBaseConfig;
+}
+
+export class Configurator extends React.Component<ConfiguratorProps> {
+    public state = {
+        instantConfig: {
+            orderSource: 'https://api.radarrelay.com/0x/v2/',
+        },
+    };
+    public render(): React.ReactNode {
+        const { hash } = this.props;
+        return (
+            <Container
+                className="flex justify-center py4 px3"
+                id={hash}
+                backgroundColor={colors.instantTertiaryBackground}
+            >
+                <Container className="mx3">
+                    <Container className="mb3">
+                        <Text fontSize="20px" lineHeight="28px" fontColor={colors.white} fontWeight={500}>
+                            0x Instant Configurator
+                        </Text>
+                    </Container>
+                    <ConfigGenerator value={this.state.instantConfig} onConfigChange={this._handleConfigChange} />
+                </Container>
+                <Container className="mx3">
+                    <Container className="mb3 flex justify-between">
+                        <Text fontSize="20px" lineHeight="28px" fontColor={colors.white} fontWeight={500}>
+                            Code Snippet
+                        </Text>
+                        <ActionLink displayText="Explore the Docs" linkSrc="/docs/instant" color={colors.grey} />
+                    </Container>
+                    <CodeDemo />
+                </Container>
             </Container>
-            <CodeDemo />
-        </Container>
-    </Container>
-);
+        );
+    }
+    private readonly _handleConfigChange = (config: ZeroExInstantBaseConfig) => {
+        this.setState({
+            instantConfig: config,
+        });
+    };
+}
-- 
cgit v1.2.3

