|
5 | 5 | [app.shared.ipc-events :refer [s-ev]]
|
6 | 6 | [app.shared.util :as u]))
|
7 | 7 |
|
| 8 | +(defn input |
| 9 | + [props] |
| 10 | + (let [input-stz "w-full p-2 text-gray-700 dark:text-gray-50 border focus:outline-none text-sm mb-4 dark:bg-gray-900 dark:border-gray-600 dark:text-white"] |
| 11 | + [:input |
| 12 | + (merge {:class input-stz} props)])) |
| 13 | + |
| 14 | +(defn textarea |
| 15 | + [props] |
| 16 | + (let [input-stz "w-full p-2 text-gray-700 dark:text-gray-50 border focus:outline-none text-sm mb-4 dark:bg-gray-900 dark:border-gray-600 dark:text-white"] |
| 17 | + [:textarea |
| 18 | + (merge {:class input-stz} props)])) |
| 19 | + |
| 20 | +(defn select |
| 21 | + [props options] |
| 22 | + (let [styles "mt-2 mb-2 flex border w-64 py-1 rounded dark:bg-gray-800 dark:text-white outline-none"] |
| 23 | + [:select (merge {:class styles} props) options])) |
| 24 | + |
8 | 25 | (defn toast
|
9 | 26 | [{:keys [type msg]}]
|
10 |
| - (prn "toast rendering " type msg) |
11 | 27 | (let [classes (str "px-4 h-full flex items-center "
|
12 | 28 | (case type :confirmation "text-green-500" :error "text-red-500" ""))]
|
13 | 29 | (when-not (empty? msg)
|
|
16 | 32 | (defn container
|
17 | 33 | "This needs to have it's react-keys resolved."
|
18 | 34 | [children]
|
19 |
| - [:div {:class "flex flex-col p-8 w-full md:w-10/12 lg:w-8/12 mx-auto max-w-screen-xl"} |
| 35 | + [:div {:class "flex flex-col p-8 w-full md:w-10/12 lg:w-8/12 mx-auto max-w-screen-xl dark:bg-gray-900"} |
20 | 36 | children])
|
21 | 37 |
|
22 | 38 | (def icons
|
|
26 | 42 |
|
27 | 43 | (defn card
|
28 | 44 | [{:keys [header]} body]
|
29 |
| - [:div.bg-white.border {:key header} |
30 |
| - [:div.border-b.px-4.py-2.text-sm.font-bold [:span header]] |
| 45 | + [:div.bg-white.border {:class (u/twld "bg-white border" "bg-gray-800 border-gray-700") |
| 46 | + :key header} |
| 47 | + [:div.border-b.px-4.py-2.text-sm.font-bold.dark:border-gray-700 [:span header]] |
31 | 48 | [:div.p-4 body]])
|
32 | 49 |
|
33 | 50 | (defn icon
|
|
91 | 108 | {:text "Settings" :id "settings"}
|
92 | 109 | {:text (u/trunc-ellipse (get current-article :name) 25)
|
93 | 110 | :id "article"}]]
|
94 |
| - [:nav.bg-white.w-full.text-xs.dark:bg-black.dark:text-gray-50.border-b |
| 111 | + [:nav.bg-white.w-full.text-xs.dark:bg-gray-800.dark:text-gray-50.border-b.dark:border-b-gray-900 |
95 | 112 | [:div.flex.items-center {:style {:height "35px"}}
|
96 | 113 | [:div.flex.flex-1.items-center
|
97 | 114 | [:div.pl-4 [trunk-logo {:width 24}]]
|
|
113 | 130 | "how single words are styled based on their familiarity/comfort."
|
114 | 131 | [{:keys [word current-word index current-word-idx on-click]}]
|
115 | 132 | (let [{:keys [name comfort _translation]} word
|
116 |
| - stz (str (u/get-comfort-bg-col comfort) " border-b border-transparent pl-1 p-0.5 mr-1 cursor-pointer bg-opacity-25 hover:bg-opacity-50") |
117 |
| - is-current-word (and (= (dissoc word :comfort) (dissoc current-word :comfort)) |
| 133 | + base-styles "border-b border-transparent px-0.5 py-px mr-1 cursor-pointer bg-opacity-25 hover:bg-opacity-50 dark:bg-opacity-50 dark:text-gray-300" |
| 134 | + stz (str (u/get-comfort-bg-col comfort) " " |
| 135 | + ;; (u/get-comfort-text-col comfort) " " |
| 136 | + base-styles) |
| 137 | + is-current-word (and (= (dissoc word :comfort) (dissoc current-word :comfort)) |
118 | 138 | (= index current-word-idx))
|
119 |
| - stz (if is-current-word (str " border-black " stz) (str " " stz))] |
| 139 | + stz (if is-current-word (str " border-black dark:border-b-gray-300 " stz) (str " " stz))] |
120 | 140 | (cond
|
121 | 141 | ;; newlines that are just from textarea...
|
122 | 142 | (= name "\n")
|
|
135 | 155 | (defn google-translate-view
|
136 | 156 | [{:keys [t-win-open? current-word]}]
|
137 | 157 |
|
138 |
| - (let [stz "absolute bottom-0 left-0 p-2 w-full text-center italic text-xs bg-white hover:bg-gray-100 text-gray-800 border-t border-gray-300 " |
| 158 | + (let [stz "absolute bottom-0 left-0 p-2 w-full text-center italic text-xs bg-white |
| 159 | + hover:bg-gray-100 text-gray-800 border-t border-gray-300 |
| 160 | + dark:bg-gray-800 dark:border-gray-900 dark:hover:bg-gray-700 dark:text-white" |
139 | 161 | button-height 33
|
140 | 162 | iframe-height 428
|
141 | 163 | window-width js/window.innerWidth
|
|
170 | 192 | (let [t-win-open? (<| [::subs/t-win-open?])
|
171 | 193 | handle-submit (fn [e]
|
172 | 194 | (.preventDefault e)
|
173 |
| - (|> [(s-ev :word-update) @form])) |
174 |
| - input-stz "w-full text-gray-700 dark:text-gray-50 border rounded-xs focus:outline-none text-md md:p-2 md:mb-4 dark:bg-gray-700 dark:text-white"] |
175 |
| - [:div {:class "bg-gray-50 w-full border-t md:border-t-0 md:flex md:w-2/5 md:relative border-l"} |
176 |
| - |
| 195 | + (|> [(s-ev :word-update) @form]))] |
| 196 | + [:div {:class "bg-gray-50 w-full border-t md:border-t-0 md:flex md:w-2/5 md:relative border-l dark:border-gray-900 dark:bg-gray-800 dark:border-gray-700"} |
177 | 197 | (when current-word
|
178 |
| - [:div {:class "w-full p-8 flex flex-col mx-auto"} |
| 198 | + [:div {:class "dark:bg-gray-800 w-full p-8 flex flex-col mx-auto"} |
179 | 199 | [:div.static
|
180 | 200 | [:div {:class "text-2xl mb-8 w-full"} (current-word :name)]
|
181 | 201 | [:form {:class "w-full" :on-submit handle-submit}
|
182 |
| - [:input {:class input-stz |
183 |
| - :placeholder "Add Translation..." |
| 202 | + [input {:placeholder "Add Translation..." |
184 | 203 | :default-value (current-word :translation)
|
185 | 204 | :value (@form :translation)
|
186 | 205 | :on-change (fn [e] (swap! form assoc :translation (-> e .-target .-value)))}]
|
|
0 commit comments