From 28da18e84a10c7e7bc5e4fb809ccfebf072239a7 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 Date: Thu, 24 May 2018 19:22:33 -0400 Subject: [PATCH] Add dropdown for boolean inputs (#1845) --- .../components/InteractExplorer/index.tsx | 45 +++++++++++++++---- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/common/containers/Tabs/Contracts/components/Interact/components/InteractExplorer/index.tsx b/common/containers/Tabs/Contracts/components/Interact/components/InteractExplorer/index.tsx index ec0cc59d..8c9687d4 100644 --- a/common/containers/Tabs/Contracts/components/Interact/components/InteractExplorer/index.tsx +++ b/common/containers/Tabs/Contracts/components/Interact/components/InteractExplorer/index.tsx @@ -109,18 +109,36 @@ class InteractExplorerClass extends Component { {/* TODO: Use reusable components with validation */} {selectedFunction.contract.inputs.map(input => { const { type, name } = input; - + const inputState = this.state.inputs[name]; return (
); @@ -244,6 +262,17 @@ class InteractExplorerClass extends Component { } } + private handleBooleanDropdownChange = ({ value, name }: { value: boolean; name: string }) => { + this.setState({ + inputs: { + ...this.state.inputs, + [name as any]: { + rawData: value.toString(), + parsedData: value + } + } + }); + }; private handleInputChange = (ev: React.FormEvent) => { const rawValue: string = ev.currentTarget.value; const isArr = rawValue.startsWith('[') && rawValue.endsWith(']');