Created
October 17, 2017 16:03
-
-
Save alandipert/396ef7759ed320430e6f7a875e58a8f2 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 "radio.html") | |
(defn radio [out-cell vals-labels] | |
(let [name (gensym "radio")] | |
(div | |
(for-tpl [[val label] vals-labels] | |
(span | |
(input {:type "radio" | |
:name name | |
:change #(reset! out-cell @%) | |
:value val}) | |
label | |
(br)))))) | |
(html | |
(head | |
(link :href "app.css" :rel "stylesheet" :type "text/css")) | |
(body | |
(h1 "Hello, Hoplon!") | |
(let [sex (cell nil)] | |
(div | |
(radio sex | |
[["male" "Male"] | |
["female" "Female"]]) | |
(p (text "Sex: ~{sex}")))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment