Skip to content

Commit c3270f3

Browse files
committed
improve mobile layout
1 parent 6c61238 commit c3270f3

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/cljs/xt_play/view.cljs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151

5252
(defn- display-error [{:keys [exception message data]} position]
5353
^{:key position}
54-
[:div {:class "flex flex-col gap-2"}
55-
[:div {:class "bg-red-100 border-l-4 border-red-500 text-red-700 p-4"}
54+
[:div {:class "flex flex-col gap-1 sm:gap-2"}
55+
[:div {:class "bg-red-100 border-l-4 border-red-500 text-red-700 p-2 sm:p-4"}
5656
[:p {:class "font-bold"} (str "Error: " exception)]
5757
[:p {:class "whitespace-pre-wrap font-mono"}
5858
(->> (str/split message #"(?:\r\n|\r|\n)")
@@ -64,8 +64,8 @@
6464
[:p (pr-str data)]])]])
6565

6666
(defn- display-warnings [warnings]
67-
[:div {:class "flex flex-col gap-2"}
68-
[:div {:class "bg-amber-500 border-l-4 border-amber-600 text-gray-500 p-4"}
67+
[:div {:class "flex flex-col gap-1 sm:gap-2"}
68+
[:div {:class "bg-amber-500 border-l-4 border-amber-600 text-gray-500 p-2 sm:p-4"}
6969
[:p {:class "font-bold"} "Warnings:"]
7070
[:p {:class "whitespace-pre-wrap font-mono"}
7171
(->> warnings
@@ -258,8 +258,9 @@
258258
(when (or @loading?
259259
@show-results?)
260260
^{:key position}
261-
[:div {:class (str half-window-col-class
262-
"grow h-auto max-h-none border overflow-x-auto overflow-y-hidden")}
261+
[:div {:class (str "sm:mx-0 flex flex-col "
262+
"sm:flex-1 md:max-w-[48vw] lg:max-w-[49vw] "
263+
"border overflow-x-auto")}
263264
(if @loading?
264265
[spinner]
265266
(let [{::run/keys [results failure response?]} @results-or-failure]
@@ -281,8 +282,8 @@
281282
(fn [idx {:keys [result error warnings timing-ms]}]
282283
^{:key idx}
283284
[:div {:class (if (pos? idx)
284-
"border-t-2 border-gray-100 py-2"
285-
"py-2")}
285+
"border-t-2 border-gray-100 py-0 sm:py-1"
286+
"py-0 sm:py-1")}
286287
(cond
287288
(not response?) initial-message
288289
(seq error) [display-error error (str position "-" idx)]
@@ -299,7 +300,7 @@
299300
(when (seq warnings)
300301
[display-warnings warnings])
301302
(when timing-ms
302-
[:div {:class "text-right text-xs text-gray-500 pr-4 pb-2"}
303+
[:div {:class "text-right text-xs text-gray-500 pr-4 pb-1"}
303304
(str timing-ms " ms")])])
304305
the-result))]))))])))
305306

@@ -313,7 +314,7 @@
313314
[:dispatch [:update-url]]]])}]])
314315

315316
(defn- add-statement-button []
316-
[:div {:class "flex flex-col sm:flex-row pb-4"}
317+
[:div {:class "flex flex-col sm:flex-row pb-2 sm:pb-4"}
317318
[:div {:class "flex-col flex-1"}
318319
[:div {:class "flex flex-row justify-center"}
319320
[:button {:class "w-10 h-10 bg-blue-500 hover:bg-blue-700 text-white font-bold py-1 rounded-full"
@@ -336,7 +337,7 @@
336337
(swap! tx-refs conj ref)
337338
^{:key id}
338339
[:<>
339-
[:div {:class "flex flex-col sm:flex-row gap-y-2"}
340+
[:div {:class "flex flex-col sm:flex-row gap-y-1 sm:gap-y-2"}
340341
[:div {:class (str half-window-col-class
341342
" grow h-fit overflow-visible sm:overflow-y-auto sm:pr-4 ")}
342343
(when (< 1 (count statements))
@@ -356,10 +357,10 @@
356357
(fn []
357358
[:div {:class "flex flex-col min-h-screen w-full"}
358359
[header @tx-type global-tx-refs]
359-
[:div {:class "py-2 sm:px-4 flex-grow flex flex-row gap-2"}
360+
[:div {:class "py-1 sm:py-2 sm:px-4 flex-grow flex flex-row gap-2"}
360361
(let [ctx {:editor (editor/default-editor @tx-type)
361362
:tx-refs global-tx-refs}]
362-
[:div {:class "flex flex-col gap-4 sm:gap-2 w-full"}
363+
[:div {:class "flex flex-col gap-1 sm:gap-2 w-full"}
363364
[statements ctx]
364365
mobile-gap])]
365366
[footer]])))

0 commit comments

Comments
 (0)