From 4ee0dfae75fda3a8b6347d55c728b50ce5c210d9 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 26 Jul 2020 18:16:59 +0200 Subject: Allow to customize icons --- src/View/Form.ml | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/View/Form.ml (limited to 'src/View/Form.ml') diff --git a/src/View/Form.ml b/src/View/Form.ml new file mode 100644 index 0000000..b0319b5 --- /dev/null +++ b/src/View/Form.ml @@ -0,0 +1,56 @@ +let section name = + H.h1 + [| HA.class_ "g-Form__Section" |] + [| H.text name |] + +let input id label init_value on_input = + H.div + [| HA.class_ "g-Form__Field" |] + [| H.div + [| HA.class_ "g-Form__Label" |] + [| H.label + [| HA.for_ id |] + [| H.text label |] + |] + ; H.input + [| HA.id id + ; HE.on_input (fun e -> on_input (Element.value (Event.target e))) + ; HA.value init_value + |] + [| |] + |] + +let color_input id label init_value on_input = + H.div + [| HA.class_ "g-Form__Field" |] + [| H.div + [| HA.class_ "g-Form__Label" |] + [| H.label + [| HA.for_ id |] + [| H.text label |] + |] + ; H.input + [| HA.id id + ; HE.on_input (fun e -> on_input (Element.value (Event.target e))) + ; HA.value init_value + ; HA.type_ "color" + |] + [| |] + |] + +let textarea id label init_value on_input = + H.div + [| HA.class_ "g-Form__Field" |] + [| H.div + [| HA.class_ "g-Form__Label" |] + [| H.label + [| HA.for_ id |] + [| H.text label |] + |] + ; H.textarea + [| HA.id id + ; HA.class_ "g-Form__Textarea" + ; HE.on_input (fun e -> on_input (Element.value (Event.target e))) + |] + [| H.text init_value |] + |] -- cgit v1.2.3