1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
(ns glimmer-tui.counter
"The smallest thing that shows the backend works: a number and two buttons.
The same component renders under glimmer-vidya in a window. Nothing here
names a terminal."
(:require [glimmer.ratom :as r :refer [atom]]
[glimmer.core :as ui]
[glimmer-tui.core]))
(defonce n (atom 0))
(defn counter []
[:vbox {:spacing 1 :margin 2}
[:title {:label "counter"}]
[:label {:label (str "n = " @n)}]
[:hbox {:spacing 2}
[:button {:label "-" :on-click #(swap! n dec)}]
[:button {:label "+" :kind :primary :on-click #(swap! n inc)}]]
[:dim-label {:label "tab moves, enter presses, ctrl-q quits"}]])
(defn -main [& _] (ui/run counter))
|