diff options
author | Joris | 2020-07-26 18:16:59 +0200 |
---|---|---|
committer | Joris | 2020-07-26 18:16:59 +0200 |
commit | 4ee0dfae75fda3a8b6347d55c728b50ce5c210d9 (patch) | |
tree | 5f73adaf57354e0070acaa9a6b60dc49c0c48526 /src/View/Modal.ml | |
parent | 447f43995ae8d83c82d98d9d8968e90d6c4518e7 (diff) |
Allow to customize icons
Diffstat (limited to 'src/View/Modal.ml')
-rw-r--r-- | src/View/Modal.ml | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/View/Modal.ml b/src/View/Modal.ml new file mode 100644 index 0000000..9365555 --- /dev/null +++ b/src/View/Modal.ml @@ -0,0 +1,27 @@ +let hide () = + let body = Document.querySelectorUnsafe "body" in + let modal = Document.querySelectorUnsafe ".g-Modal" in + Element.removeChild body modal + +let show content = + let body = Document.querySelectorUnsafe "body" in + let view = + H.div + [| HA.class_ "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.text "X" |] + ; content + |] + |] + in + Element.appendChild body view |