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