git ssb

2+

VictorBjelkholm (lasoa) / metabutt



Commit 74e6a9efcd58175b0b939fbc958cf2f8a77597ba

Ability to switch themes

Sunny spain requires different themes for different times of the day

License: MIT
Signed-off-by: Victor Bjelkholm <git@victor.earth>
victorbjelkholm committed on 1/18/2020, 2:45:46 PM
Parent: 606f5064ca6cdb064af713ac7257b71ceb5d4f6d

Files changed

resources/public/css/style.csschanged
src/metabutt/core.cljschanged
resources/public/css/style.cssView
@@ -2,13 +2,21 @@
22
33 html, body {
44 padding: 0;
55 margin: 0;
6 + font-family: 'Space Mono', sans-serif;
7 +}
8 +
9 +.theme-dark {
610 background-color: #0F192A;
711 color: white;
8- font-family: 'Space Mono', sans-serif;
912 }
1013
14 +.theme-light {
15 + background-color: white;
16 + color: #0F192A;
17 +}
18 +
1119 button, input {
1220 font-family: 'Space Mono', sans-serif;
1321 background-color: #0F192A;
1422 border: 1px solid white;
@@ -36,31 +44,50 @@
3644 max-width: 100%;
3745 }
3846
3947 .query-link {
40- color: white;
4148 display: block;
4249 padding: 3px;
4350 }
4451
45-.query-link.selected {
52 +.theme-dark .query-link {
53 + color: white;
54 +}
55 +
56 +.theme-light .query-link {
57 + color: #0F192A;
58 +}
59 +
60 +.theme-dark .query-link.selected {
4661 background-color: white;
4762 color: black;
4863 }
4964
65 +.theme-light .query-link.selected {
66 + background-color: black;
67 + color: white;
68 +}
69 +
5070 label {
5171 display: block;
5272 border: 1px solid lightgrey;
5373 margin: 10px;
5474 padding: 5px;
5575 }
5676
57-h3 {
77 +h1, h3 {
5878 margin: 0px;
5979 padding: 0px;
6080 }
6181
6282 pre {
6383 font-family: 'Space Mono', sans-serif;
64- background-color: #0F192A;
6584 white-space: pre-line;
6685 }
86 +
87 +.theme-dark pre {
88 + background-color: #0F192A;
89 +}
90 +
91 +.theme-light pre {
92 + background-color: lightgrey;
93 +}
src/metabutt/core.cljsView
@@ -45,8 +45,9 @@
4545
4646
4747 (defonce app-state (atom {:name "Demo Query"
4848 :show-debug? false
49 + :theme "dark"
4950 :ui demo-ui
5051 :query demo-query
5152 :loading? false
5253 :result []
@@ -295,14 +296,23 @@
295296
296297 (defn get-hash []
297298 (clojure.string/join "" (rest js/window.location.hash)))
298299
300 +(defn $themes []
301 + [:select
302 + {:onChange #(swap! app-state assoc :theme (-> % .-target .-value))}
303 + [:option {:value "dark"} "Theme - Dark"]
304 + [:option {:value "light"} "Theme - Light"]])
305 +
299306 (defn $header []
300307 [:div
301- [:h1 "metabutt"]])
308 + [:h1 "metabutt"]
309 + [$themes]])
302310
311 +
303312 (defn app []
304313 [:div
314 + {:class (str "theme-" (:theme @app-state))}
305315 [$header]
306316 [:div
307317 {:style {:width "50%"
308318 :float "left"}}
@@ -337,9 +347,10 @@
337347 :float "right"}}
338348 [:div "Results: " (count (:result @app-state))]
339349 (when (:loading? @app-state)
340350 [:div "Loading results..."])
341- [error-catcher [:div [$ui]]]]])
351 + [error-catcher [:div [$ui]]]]
352 + [:div {:style {:clear "both"}}]])
342353
343354 (defn handle-hash-change []
344355 (swap! app-state
345356 assoc

Built with git-ssb-web