From 95585fb43d89d4e39ee853dc08faa155b618740f Mon Sep 17 00:00:00 2001 From: Roman Galochkin Date: Thu, 27 Feb 2020 09:21:47 +0300 Subject: [PATCH] Makes use Antd components --- src/components/DistBuilder.re | 211 ++++++++++++++++++---------------- 1 file changed, 115 insertions(+), 96 deletions(-) diff --git a/src/components/DistBuilder.re b/src/components/DistBuilder.re index fc5d891d..6a3e60a1 100644 --- a/src/components/DistBuilder.re +++ b/src/components/DistBuilder.re @@ -1,4 +1,5 @@ open BsReform; +open Antd.Grid; module FormConfig = [%lenses type state = { @@ -40,10 +41,20 @@ module FieldString = { module Styles = { open Css; - let row = - style([display(`flex), selector("div > div", [flex(`num(1.))])]); + let rows = + style([ + selector( + ">.ant-col:first-child", + [paddingLeft(em(0.25)), paddingRight(em(0.125))], + ), + selector( + ">.ant-col:last-child", + [paddingLeft(em(0.125)), paddingRight(em(0.25))], + ), + ]); let form = style([backgroundColor(hex("eee")), padding(em(1.))]); - let spacer = style([marginTop(em(3.))]); + let dist = style([padding(em(1.))]); + let spacer = style([marginTop(em(1.))]); }; module FieldFloat = { @@ -64,6 +75,26 @@ module FieldFloat = { }; }; +module DemoDist = { + [@react.component] + let make = (~guesstimatorString, ~domain, ~unit) => { + E.ste}> +
+
+
+ {DistPlusIngredients.make(~guesstimatorString, ~domain, ~unit, ()) + |> DistPlusIngredients.toDistPlus( + ~sampleCount=10000, + ~outputXYPoints=2000, + ~truncateTo=Some(1000), + ) + |> E.O.React.fmapOrNull(distPlus => )} +
+
+ ; + }; +}; + [@react.component] let make = () => { let reform = @@ -134,29 +165,36 @@ let make = () => { let guesstimatorString = reform.state.values.guesstimatorString; + let demoDist = + React.useMemo1( + () => {}, + [| + reform.state.values.guesstimatorString, + reform.state.values.domainType, + reform.state.values.xPoint, + reform.state.values.xPoint2, + reform.state.values.xPoint2, + reform.state.values.excludingProbabilityMass, + reform.state.values.excludingProbabilityMass2, + reform.state.values.unitType, + reform.state.values.zero |> E.M.format(E.M.format_standard), + reform.state.values.unit, + |], + ); +
-
-
- {DistPlusIngredients.make(~guesstimatorString, ~domain, ~unit, ()) - |> DistPlusIngredients.toDistPlus( - ~sampleCount=10000, - ~outputXYPoints=2000, - ~truncateTo=Some(1000), - ) - |> E.O.React.fmapOrNull(distPlus => )} -
-
+ demoDist
-
+ E.ste}> -
-
+ + @@ -178,28 +216,36 @@ let make = () => { } /> -
-
- -
-
- -
-
- -
-
- -
-
-
-
+ + + + + + + + + + + + + + + + + + + + + + + + @@ -215,64 +261,37 @@ let make = () => { } /> -
-
- - E.ste}> - { - e |> handleChange; - _ => (); - }} - /> - - } - /> -
-
- - 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} - - - - } - /> -
-
+ + + + + + E.ste}> + { + e |> handleChange; + _ => (); + }} + /> + + } + /> + + + + + + + +
-
+
; };