diff options
Diffstat (limited to 'src/Lib/Modal.ml')
-rw-r--r-- | src/Lib/Modal.ml | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Lib/Modal.ml b/src/Lib/Modal.ml new file mode 100644 index 0000000..3fa0550 --- /dev/null +++ b/src/Lib/Modal.ml @@ -0,0 +1,25 @@ +let hide () = + let modal = Document.query_selector_unsafe "#g-Modal" in + Element.remove_child Document.body modal + +let show content = + let view = + H.div + [| HA.id "g-Modal" |] + [| H.div + [| HA.class_ "g-Modal__Curtain" + ; HE.on_click (fun _ -> hide ()) + |] + [| |] + ; H.div + [| HA.class_ "g-Modal__Window" |] + [| H.button + [| HA.class_ "g-Modal__Close" + ; HE.on_click (fun _ -> hide ()) + |] + [| H.div [| HA.class_ "fa fa-close" |] [| |] |] + ; content + |] + |] + in + Element.append_child Document.body view |