Skip to content

Instantly share code, notes, and snippets.

@alandipert
Created October 19, 2015 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alandipert/899eb915ca3103e8f775 to your computer and use it in GitHub Desktop.
Save alandipert/899eb915ca3103e8f775 to your computer and use it in GitHub Desktop.
(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