-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
135 lines (131 loc) · 6.82 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<!DOCTYPE html>
<html lang="pt-br"><head><meta charset="UTF-8"><meta content="width=device-width, initial-scale=1.0" name="viewport"><meta content="Clojure Brasil" name="description"><meta content="#1793d1" name="theme-color"><meta content="website" property="og:type"><meta content="Comunidade Clojure Brasil" property="og:description"><meta content="Clojure Brasil" property="og:title"><meta content="https://clj-br.github.io/" property="og:url"><meta content="https://clj-br.github.io//resources/logo.svg" property="og:image"><title>Clojure Brasil</title><link href="data:application/json,%7B%22theme_color%22%3A%22%231793d1%22%2C%22start_url%22%3A%22https%3A%2F%2Fclj-br.github.io%2F%22%2C%22name%22%3A%22Clojure+Brasil%22%2C%22background_color%22%3A%22%234d4d4d%22%2C%22short_name%22%3A%22clj-br%22%2C%22icons%22%3A%5B%7B%22src%22%3A%22https%3A%2F%2Fclj-br.github.io%2F%2Fresources%2Flogo.svg%22%2C%22sizes%22%3A%22192x192%22%2C%22type%22%3A%22image%2Fpng%22%7D%2C%7B%22src%22%3A%22https%3A%2F%2Fclj-br.github.io%2F%2Fresources%2Flogo.svg%22%2C%22sizes%22%3A%22512x512%22%2C%22type%22%3A%22image%2Fsvg%2Bxml%22%7D%5D%2C%22display%22%3A%22minimal-ui%22%2C%22manifest_version%22%3A2%2C%22version%22%3A%221%22%7D" rel="manifest"><link href="https://clj-br.github.io/" rel="canonical"><link href="resources/logo.svg" rel="icon"><style>
headers > img {
max-width: 20vh;
max-height: 20vh;
}
body {
text-align: center;
padding: 2vh;
max-width: 38em;
margin: auto;
}
ul {
padding: 0;
list-style-type: none;
}
li {
padding: 1em;
}
</style></head><body><headers><img alt="Logotipo da clojure Brasil, que mistura o logotipo original, inspirado em yin yang, com o formato de uma arara, mantendo as cores originais: tons leves de azul e verde." src="resources/logo.svg"></headers><h1>Clojure Brasil</h1><div id="playground"><ul><li><a href="https://t.me/clojurebrasil" rel="noreferrer noopener" target="_blank">Grupo no Telegram</a></li><li><a href="https://github.com/clj-br/forum/discussions" rel="noreferrer noopener" target="_blank">Duvidas e discussões</a></li><li><a href="https://github.com/clj-br/vagas" rel="noreferrer noopener" target="_blank">Vagas e oportunidades de trabalho</a></li></ul></div><p>Comece a aprender agora mesmo!</p><ul style="display:flex;flex-wrap:wrap;justify-content:center;"><li><button data-target="editor" data-value="[:ul
[:li
[:a
{:target "_blank",
:rel "noreferrer noopener",
:href "https://t.me/clojurebrasil"}
"Grupo no Telegram"]]
[:li
[:a
{:target "_blank",
:rel "noreferrer noopener",
:href "https://github.com/clj-br/forum/discussions"}
"Duvidas e discussões"]]
[:li
[:a
{:target "_blank",
:rel "noreferrer noopener",
:href "https://github.com/clj-br/vagas"}
"Vagas e oportunidades de trabalho"]]]
" onClick="document.getElementById(this.dataset.target).value = this.dataset.value;
document.getElementById(this.dataset.target).onkeyup()">Website</button></li><li><button data-target="editor" data-value="(+ 1 2)
" onClick="document.getElementById(this.dataset.target).value = this.dataset.value;
document.getElementById(this.dataset.target).onkeyup()">Soma simples</button></li><li><button data-target="editor" data-value="(require '[reagent.core :as r])
(def *n (r/atom 0))
(defn
contador
[]
[:div
[:div (str "Contador: " @*n)]
[:button {:onClick (fn [] (swap! *n inc))} "incrementar"]])
" onClick="document.getElementById(this.dataset.target).value = this.dataset.value;
document.getElementById(this.dataset.target).onkeyup()">Contador</button></li><li><button data-target="editor" data-value="
(require '[reagent.core :as r])
(def *notas (r/atom {0 {:nota "Conhecer Clojure" :feito? true}
1 {:nota "Aprender Clojure"}}))
(def *nova-nota (r/atom ""))
(defn ui-root []
[:div
(for [[id {:keys [nota feito?]}] @*notas]
[:div
{:key id}
[:input
{:type "checkbox"
:on-change #(swap! *notas update-in [id :feito?] not)
:checked feito?}]
nota
(when feito?
[:button {:on-click (fn [] (swap! *notas dissoc id))} "x"])])
[:input {:value @*nova-nota
:on-change (fn [evt] (reset! *nova-nota (-> evt .-target .-value)))}]
[:button {:on-click (fn []
(swap! *notas assoc (random-uuid) {:nota @*nova-nota})
(reset! *nova-nota ""))}
"+"]])
" onClick="document.getElementById(this.dataset.target).value = this.dataset.value;
document.getElementById(this.dataset.target).onkeyup()">Aplicativo de notas</button></li></ul><textarea autocomplete="off" id="editor" onkeyup="this.dataset.state == 'done' ? this.dataset.state = 'idle' : null" rows="20" style="width:100%;">[:ul
[:li
[:a
{:target "_blank",
:rel "noreferrer noopener",
:href "https://t.me/clojurebrasil"}
"Grupo no Telegram"]]
[:li
[:a
{:target "_blank",
:rel "noreferrer noopener",
:href "https://github.com/clj-br/forum/discussions"}
"Duvidas e discussões"]]
[:li
[:a
{:target "_blank",
:rel "noreferrer noopener",
:href "https://github.com/clj-br/vagas"}
"Vagas e oportunidades de trabalho"]]]
</textarea><div id="playground"></div><pre id="stderr"></pre><script src="https://cdn.jsdelivr.net/gh/borkdude/[email protected]/js/scittle.js" type="application/javascript"></script><script crossorigin="true" src="https://unpkg.com/react@17/umd/react.production.min.js"></script><script crossorigin="true" src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script><script src="https://cdn.jsdelivr.net/gh/borkdude/[email protected]/js/scittle.reagent.js" type="application/javascript"></script><script type="application/x-scittle">(require '[reagent.core :as r] '[reagent.dom :as rdom])
(defn
render
[]
(let
[stderr
(.getElementById js/document "stderr")
editor
(.getElementById js/document "editor")]
(when
(-> editor .-dataset .-state #{"idle"})
(set! (-> editor .-dataset .-state) "loading")
(try
(let
[component
(-> js/window .-scittle .-core (.eval_string (.-value editor)))]
(rdom/render
(cond
(fn? component)
[component]
(var? component)
[component]
(vector? component)
component
:else
[:pre (pr-str component)])
(.getElementById js/document "playground"))
(set! (.-innerText stderr) ""))
(catch
:default
ex
(set!
(.-innerText stderr)
(str (ex-message ex) "\n" (str (ex-data ex)))))))
(set! (-> editor .-dataset .-state) "done"))
(js/setTimeout render 1000))
(render)
</script></body></html>