From 09e0714ec4e4bde28517e6d752b6a66a561728bc Mon Sep 17 00:00:00 2001 From: Roman Galochkin Date: Wed, 26 Feb 2020 13:38:29 +0300 Subject: [PATCH] Adds a component --- src/DistBuilder.re | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/DistBuilder.re diff --git a/src/DistBuilder.re b/src/DistBuilder.re new file mode 100644 index 00000000..eccc3cce --- /dev/null +++ b/src/DistBuilder.re @@ -0,0 +1,63 @@ +open BsReform; + +module FormConfig = [%lenses + type state = { + name: string, + description: string, + picture: string, + } +]; + +module Form = ReForm.Make(FormConfig); + +let schema = Form.Validation.Schema([||]); + +module FieldString = { + [@react.component] + let make = (~field, ~label) => { + + E.ste}> + validate()} + /> + + } + />; + }; +}; + +[@react.component] +let make = () => { + let reform = + Form.use( + ~validationStrategy=OnDemand, + ~schema, + ~onSubmit=({state}) => {None}, + ~initialState={name: "", description: "", picture: ""}, + (), + ); + + let onSubmit = e => { + e->ReactEvent.Synthetic.preventDefault; + reform.submit(); + }; + + + + + + + + {reform.state.formState == Submitting + ? "Loading" |> E.ste + : + {"Submit" |> E.ste} + } + + + ; +};