Last active
October 27, 2023 12:28
-
-
Save borkdude/e83da19df3d2739861334171779f79d5 to your computer and use it in GitHub Desktop.
hoplon demo
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
(ns view.index | |
(:require | |
[hoplon.core :as h] | |
[javelin.core :as j])) | |
(defn my-list [& items] | |
(h/div :class "my-list" | |
(apply h/ul (map #(h/li (h/div :class "my-list-item" %)) items)))) | |
(defonce clicks (j/cell 0)) | |
(def clicks-times-3 (j/cell= (* 3 clicks))) | |
(defn hello [] | |
(h/div | |
(h/h1 "Hello, Hoplon") | |
(my-list | |
(h/span "first thing") | |
(h/span "second thing")) | |
(h/p (h/text "You've clicked ~{clicks} times, so far. (times 3 = ~{clicks-times-3})")) | |
(h/button :click #(swap! clicks inc) "click me"))) | |
(.replaceChildren (.getElementById js/document "app") | |
(hello)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment