open Prop; let handleChange = (handleChange, event) => handleChange(ReactEvent.Form.target(event)##value); type onChange = option(Value.t) => unit; [@react.component] let make = ( ~type_: TypeWithMetadata.t, ~value: option(Value.t), ~onChange: onChange, ) => { switch (type_.type_, value) { | (Conditionals(_), r) => "sdfsdf" |> ReasonReact.string | (Year(_), Some(FloatPoint(r))) => Js.Float.toString} onChange={handleChange(r => switch (Js.Float.fromString(r)) { | r => onChange(Some(Value.FloatPoint(r))) } )} /> | (FloatPoint(_), Some(FloatPoint(r))) => Js.Float.toString} onChange={handleChange(r => switch (Js.Float.fromString(r)) { | r => onChange(Some(Value.FloatPoint(r))) } )} /> | (BinaryConditional, Some(BinaryConditional(r))) => switch (r) { | Unselected =>
onChange(Some(BinaryConditional(Selected(true))))}> {"Select" |> ReasonReact.string}
| Selected(true) =>
{"YES!" |> ReasonReact.string}
onChange(Some(BinaryConditional(Selected(false))))}> {"No" |> ReasonReact.string}
onChange(Some(BinaryConditional(Unselected)))}> {"Deselect" |> ReasonReact.string}
| Selected(false) =>
{"NO!" |> ReasonReact.string}
onChange(Some(BinaryConditional(Selected(true))))}> {"Yes" |> ReasonReact.string}
onChange(Some(BinaryConditional(Unselected)))}> {"Deselect" |> ReasonReact.string}
} | (Year(_), _) | (FloatPoint(_), _) => | (SelectSingle(t), Some(SelectSingle(r))) => | (DateTime(_), Some(DateTime((d: MomentRe.Moment.t)))) => onChange( Some(Value.DateTime(MomentRe.momentWithFormat(r, "YYYY-MM-DD"))), ) )} /> }; };