From 2936f06576997bffe7903ea840df563a408efc21 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 9 Aug 2020 18:46:05 +0200 Subject: Improve autocompletion usage --- src/View/Map/Marker.ml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/View/Map') diff --git a/src/View/Map/Marker.ml b/src/View/Map/Marker.ml index c628c3a..1c0c0d6 100644 --- a/src/View/Map/Marker.ml +++ b/src/View/Map/Marker.ml @@ -18,7 +18,12 @@ let form on_validate colors init_name init_color init_icon = |] [| Layout.section [| |] - [| Form.input "g-MarkerForm__Name" "Name" init_name (fun newName -> name := newName) + [| Form.input + "g-MarkerForm__Name" + "Name" + [| HE.on_input (fun e -> name := (Element.value (Event.target e))) + ; HA.value init_name + |] ; Form.color_input colors "g-MarkerForm__Color" "Color" init_color (fun newColor -> color := newColor) ; H.div [| HA.class_ "g-Form__Field" |] @@ -30,10 +35,11 @@ let form on_validate colors init_name init_color init_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 |] + [| HA.class_ "g-MarkerForm__AutocompleteAndIcon" |] + [| Autocomplete.create + [| HA.value init_icon + ; HA.class_ "g-MarkerForm__Autocomplete" + |] "g-MarkerForm__IconInput" FontAwesome.icons (fun icon -> @@ -45,6 +51,7 @@ let form on_validate colors init_name init_color init_icon = (fun newIcon -> let () = icon := newIcon in Element.set_class_name dom_icon ("fa fa-" ^ newIcon)) + ; H.div [| HA.class_ "g-MarkerForm__Icon" |] [| dom_icon |] |] |] |] -- cgit v1.2.3