-
-
Save jaen/dd22b3432581fc7ab8f5 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
(defn scoreboard-component [] | |
(let [game-state (atom [])] | |
(api/get-game ...) | |
(fn [] | |
[:div | |
[:table | |
[:tbody | |
(doall | |
(map-indexed (fn [idx {:keys [name min pos points]}] | |
[:tr | |
[:td name] | |
[:td | |
[:input {:on-change (fn [e] | |
(let [new-value (.. e -target -value)] | |
(swap! game-state update-in [idx] assoc :min new-value)) | |
(.preventDefault e)) | |
:value min}]} | |
[:td [:input ...]] | |
[:td [:input ...]]]]) | |
@game-state))]] | |
[:button {:on-click (fn [e] | |
(api/update-game! @game-state) | |
(.preventDefault e))} | |
"Send this!"]]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment