From de882523bb9cb9b9621e6a23e5de45f9981d3d50 Mon Sep 17 00:00:00 2001 From: Roman Galochkin Date: Thu, 27 Feb 2020 10:43:37 +0300 Subject: [PATCH] Hides inputs --- src/components/DistBuilder.re | 123 +++++++++++++++++++++++++++------- src/utility/E.re | 1 + 2 files changed, 99 insertions(+), 25 deletions(-) diff --git a/src/components/DistBuilder.re b/src/components/DistBuilder.re index 78f6fd79..3f82b176 100644 --- a/src/components/DistBuilder.re +++ b/src/components/DistBuilder.re @@ -66,7 +66,7 @@ module FieldNumber = { module FieldFloat = { [@react.component] - let make = (~field, ~label) => { + let make = (~field, ~label, ~className=Css.style([])) => { @@ -78,6 +78,7 @@ module FieldFloat = { (); }} onBlur={_ => validate()} + className /> } @@ -110,6 +111,20 @@ module Styles = { let form = style([backgroundColor(hex("eee")), padding(em(1.))]); let dist = style([padding(em(1.))]); let spacer = style([marginTop(em(1.))]); + let groupA = + style([ + selector( + ".ant-input-number-input", + [backgroundColor(hex("fff7db"))], + ), + ]); + let groupB = + style([ + selector( + ".ant-input-number-input", + [backgroundColor(hex("eaf4ff"))], + ), + ]); }; module DemoDist = { @@ -150,7 +165,7 @@ let make = () => { ~onSubmit=({state}) => {None}, ~initialState={ guesstimatorString: "mm(5 to 20, floor(normal(20,2)), [.5, .5])", - domainType: "Complete", + domainType: "LeftLimited", xPoint: 50.0, xPoint2: 60.0, excludingProbabilityMass2: 0.5, @@ -296,31 +311,57 @@ let make = () => { } /> - - - - - - - - - - - - + {<> + + + + + + + + |> E.showIf( + E.L.contains( + reform.state.values.domainType, + ["LeftLimited", "RightLimited", "LeftAndRightLimited"], + ), + )} + {<> + + + + + + + + |> E.showIf( + E.L.contains( + reform.state.values.domainType, + ["LeftAndRightLimited"], + ), + )} - E.ste}> + E.ste}> e |> handleChange}> {"Unspecified Distribution" |> E.ste} @@ -337,7 +378,7 @@ let make = () => { - E.ste}> + E.ste}> { @@ -350,9 +391,41 @@ let make = () => { /> - + E.ste}> + e |> handleChange}> + + {"Days" |> E.ste} + + + {"Hours" |> E.ste} + + + {"Milliseconds" |> E.ste} + + + {"Minutes" |> E.ste} + + + {"Months" |> E.ste} + + + {"Quarters" |> E.ste} + + + {"Seconds" |> E.ste} + + + {"Weeks" |> E.ste} + + + {"Years" |> E.ste} + + + + } /> diff --git a/src/utility/E.re b/src/utility/E.re index 9be83a65..2e0ba052 100644 --- a/src/utility/E.re +++ b/src/utility/E.re @@ -299,3 +299,4 @@ module JsArray = { }; let ste = React.string; +let showIf = (cond, comp) => cond ? comp : ReasonReact.null;