Last active
August 29, 2015 14:21
-
-
Save jjmojojjmojo/f114d1b48a46a5e8b2ea to your computer and use it in GitHub Desktop.
Hoplon toggle button array
This file contains hidden or 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 "test.html") | |
(defc working-set []) | |
(defn setup-working-set | |
"Initially populate the working set - normally the result of an async call" | |
[data] | |
(let [wset (map (fn [c] [c false]) data)] | |
(reset! working-set wset)) | |
(prn working-set)) | |
(setup-working-set ["T", "U", "V", "W"]) | |
(html | |
(head | |
(title "Hoplon FTW")) | |
(body | |
(h1 "Watch and wonder!") | |
(div | |
(loop-tpl | |
:bindings [[c state] working-set] | |
(div | |
(h2 :text (cell= c)) | |
(span :text (cell= (if state "picked!" "left behind!"))) | |
(button | |
:text "Click it" | |
:click #(swap! state not))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment