aboutsummaryrefslogtreecommitdiff
path: root/src/View/Form.ml
diff options
context:
space:
mode:
authorJoris2020-07-26 18:16:59 +0200
committerJoris2020-07-26 18:16:59 +0200
commit4ee0dfae75fda3a8b6347d55c728b50ce5c210d9 (patch)
tree5f73adaf57354e0070acaa9a6b60dc49c0c48526 /src/View/Form.ml
parent447f43995ae8d83c82d98d9d8968e90d6c4518e7 (diff)
Allow to customize icons
Diffstat (limited to 'src/View/Form.ml')
-rw-r--r--src/View/Form.ml56
1 files changed, 56 insertions, 0 deletions
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 |]
+ |]