-
-
Save alandipert/899eb915ca3103e8f775 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(page "index.html") | |
(let [msg (cell nil)] | |
(defn dialog! [m] | |
(reset! msg m)) | |
(defelem ok-dialog [attrs kids] | |
(div | |
:css {:position "absolute" | |
:width "300px" | |
:left "50%" | |
:top "50%" | |
:transform "translate(-50%, -50%)" | |
:border "3px solid black" | |
:padding "10px"} | |
:toggle msg | |
:id "dialog-box" | |
(h4 msg) | |
(button :click #(reset! msg nil) "OK")))) | |
(html | |
(head | |
(link :href "app.css" :rel "stylesheet")) | |
(body | |
(ok-dialog) | |
(h1 "Hello, Hoplon!") | |
(button :click #(dialog! "Hello from button") "See dialog"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment