From 3e39f97d844dbe0ff5f57e3977bc220d366d4c0e Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 8 Aug 2020 13:41:27 +0200 Subject: Show icons in marker form --- src/View/Map/Marker.ml | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'src/View/Map') diff --git a/src/View/Map/Marker.ml b/src/View/Map/Marker.ml index 58ec4bd..e793742 100644 --- a/src/View/Map/Marker.ml +++ b/src/View/Map/Marker.ml @@ -20,12 +20,28 @@ let form on_validate init_name init_color init_icon = [| |] [| Form.input "g-MarkerForm__Name" "Name" init_name (fun newName -> name := newName) ; Form.color_input "g-MarkerForm__Color" "Color" init_color (fun newColor -> color := newColor) - ; Autocomplete.create - "g-MarkerForm__Icon" - "Icon" - FontAwesome.icons - (fun newIcon -> let () = Js.log newIcon in icon := newIcon) - [| HA.value init_icon |] + ; H.div + [| HA.class_ "g-Form__Field" |] + [| H.div + [| HA.class_ "g-Form__Label" |] + [| H.label + [| HA.for_ "g-MarkerForm__IconInput" |] + [| H.text "Icon" |] + |] + ; let dom_icon = H.div [| HA.class_ ("fa fa-" ^ !icon) |] [| |] in + Layout.line + [| |] + [| H.div [| HA.class_ "g-MarkerForm__Icon" |] [| dom_icon |] + ; Autocomplete.create + [| HA.value init_icon |] + "g-MarkerForm__IconInput" + FontAwesome.icons + (fun icon -> [| H.div [| HA.class_ ("fa fa-" ^ icon) |] [| |] ; H.text icon |]) + (fun newIcon -> + let () = icon := newIcon in + Element.set_class_name dom_icon ("fa fa-" ^ newIcon)) + |] + |] |] ; Layout.line [| |] -- cgit v1.2.3