Skip to content

Commit f68ffe6

Browse files
improve side REPL layout and buttons
1 parent 18948a8 commit f68ffe6

File tree

1 file changed

+39
-31
lines changed

1 file changed

+39
-31
lines changed

src/civitas/repl.clj

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -252,23 +252,6 @@
252252
:height "100vh"
253253
:padding-top "77px"}))}
254254

255-
;; Button bar
256-
(when (not collapsed?)
257-
[:div.d-flex.justify-content-between.align-items-center
258-
{:style {:flex "0 0 auto"
259-
:order "0"}}
260-
[:div.btn-group
261-
[:button.btn.btn-outline-primary.btn-sm
262-
{:on-click toggle!}
263-
(if is-bottom?
264-
[:i.bi.bi-chevron-bar-down]
265-
[:i.bi.bi-chevron-bar-right])
266-
" Hide"]
267-
[:button.btn.btn-outline-secondary.btn-sm
268-
{:on-click switch-layout!}
269-
"↕ Switch Layout"]]
270-
[:small.text-muted "Ctrl+Enter to eval"]])
271-
272255
;; Restore button
273256
(when collapsed?
274257
[:button.btn.btn-outline-primary.w-100.h-100
@@ -283,12 +266,33 @@
283266
{:style {:flex "1 1 auto"
284267
:order "1"
285268
:display "flex"
286-
:flex-direction (if is-bottom? "row" "column")}}
269+
:flex-direction (if is-bottom? "row" "column")
270+
:min-height "0"}}
287271

288272
;; Editor
289-
[:div.position-relative
290-
{:style {:flex "1 1 0"
291-
:overflow "hidden"}}
273+
[:div.position-relative.d-flex.flex-column
274+
{:style {:flex "1 1 0"
275+
:overflow "hidden"
276+
:min-height "0"
277+
:min-width "0"}}
278+
[:div.d-flex.justify-content-between.align-items-center
279+
{:style {:flex "0 0 auto"}}
280+
[:div.btn-group
281+
[:button.btn.btn-outline-primary.btn-sm
282+
{:on-click toggle!}
283+
(if is-bottom?
284+
[:i.bi.bi-chevron-bar-down]
285+
[:i.bi.bi-chevron-bar-right])
286+
" Hide"]
287+
[:button.btn.btn-outline-secondary.btn-sm
288+
{:on-click switch-layout!}
289+
"↕ Switch Layout"]
290+
[:button.btn.btn-primary.btn-sm
291+
{:on-click (fn [_]
292+
(when @editor-ref
293+
(eval-code! (.-value @editor-ref))))}
294+
"Eval (Ctrl+Enter)"]]]
295+
[:div {:style {:flex "1 1 0" :min-height "0"}}
292296
[:textarea.form-control.border-0
293297
{:ref #(reset! editor-ref %)
294298
:on-key-down (fn [e]
@@ -302,25 +306,29 @@
302306
:font-family "var(--bs-font-monospace)"
303307
:font-size "0.875rem"
304308
:border-radius "0"
305-
:overflow-y "auto"}}]]
309+
:overflow-y "auto"}}]]]
306310

307311
;; REPL Output
308312
[:div.position-relative
309-
{:style {:flex "1 1 0"
310-
:overflow "hidden"}}
311-
312-
;; Floating label in top-right
313-
[:div.position-absolute.top-0.end-0.badge.bg-secondary.m-2
314-
{:style {:font-size "0.65rem"
315-
:z-index "10"}}
316-
"Output"]
313+
{:style {:flex "1 1 0"
314+
:overflow "hidden"
315+
:min-height "0"
316+
:min-width "0"}}
317+
318+
;; Output button overlay
319+
[:div.position-absolute.top-0.end-0
320+
{:style {:z-index "10"}}
321+
[:button.btn.btn-outline-secondary.btn-sm
322+
{:on-click #(reset! repl-output [])}
323+
"Clear Output"]]
317324

318325
[:div#repl-output.sourceCode.border-start
319326
{:ref #(reset! output-ref %)
320327
:class (if is-bottom? "border-start" "border-top")
321328
:style {:height "100%"
322-
:padding "0.75rem"
329+
:margin 0
323330
:overflow-y "auto"
331+
:min-height "0"
324332
:font-family "var(--bs-font-monospace)"
325333
:font-size "0.8125rem"
326334
:line-height "1.4"}}

0 commit comments

Comments
 (0)