|
9 | 9 |
|
10 | 10 | (def taps-viewer
|
11 | 11 | {:render-fn '(fn [taps {:as opts :keys [taps-view]}]
|
12 |
| - [:div |
13 |
| - [:div.flex.justify-between.items-center |
14 |
| - (into [:div.flex.items-center.font-sans.text-xs.mb-3 [:span.text-slate-500.mr-2 "View-as:"]] |
| 12 | + [:div.flex.flex-col |
| 13 | + [:div.flex.justify-between.items-center.font-sans.border-b.border-t.shadow.z-1 |
| 14 | + {:class "text-[11px] height-[24px] px-[8px]"} |
| 15 | + (into [:div.flex.items-center] |
15 | 16 | (map (fn [choice]
|
16 |
| - [:button.px-3.py-1.font-medium.hover:bg-indigo-50.rounded-full.hover:text-indigo-600.transition |
17 |
| - {:class (if (= taps-view choice) "bg-indigo-100 text-indigo-600" "text-slate-500") |
| 17 | + [:button.transition-all.mr-2.relative |
| 18 | + {:class (str "h-[24px] border-b-2 " |
| 19 | + (if (= taps-view choice) |
| 20 | + "text-indigo-600 border-indigo-600 font-bold " |
| 21 | + "text-slate-500 border-transparent hover:text-indigo-600 ")) |
18 | 22 | :on-click #(nextjournal.clerk.render/clerk-eval `(set-view! ~choice))}
|
19 |
| - choice]) [:stream :latest])) |
20 |
| - [:button.text-xs.rounded-full.px-3.py-1.border-2.font-sans.hover:bg-slate-100.cursor-pointer |
21 |
| - {:on-click #(nextjournal.clerk.render/clerk-eval `(tap/reset-taps!))} "Clear"]] |
22 |
| - (into [:div] |
| 23 | + [:span.relative {:class "-bottom-[2px]"} (clojure.string/capitalize (name choice))]]) |
| 24 | + [:stream :latest])) |
| 25 | + [:button.text-slate-500.hover:text-indigo-600 |
| 26 | + {:on-click #(nextjournal.clerk.render/clerk-eval `(tap/reset-taps!))} |
| 27 | + "Clear"]] |
| 28 | + (into [:div.overflow-auto |
| 29 | + {:style {:height "calc(100% - 40px)"}}] |
23 | 30 | (nextjournal.clerk.viewer/inspect-children opts)
|
24 | 31 | (cond->> taps (= :latest taps-view) (take 1)))])})
|
25 | 32 |
|
26 | 33 | (defn open!
|
27 | 34 | ([id]
|
28 | 35 | (case id
|
29 |
| - ::taps (open! id {:title "🚰 Taps" :css-class "p-0"} |
| 36 | + ::taps (open! id {:title "🚰 Taps" :css-class "p-0 relative overflow-auto"} |
30 | 37 | (v/with-viewers (v/add-viewers [tap/tap-viewer])
|
31 |
| - (v/with-viewer taps-viewer {:nextjournal/opts {:taps-view @!taps-view}} |
32 |
| - @tap/!taps))))) |
| 38 | + (v/with-viewer taps-viewer {:nextjournal/opts {:taps-view @!taps-view}} |
| 39 | + @tap/!taps))))) |
33 | 40 | ([id content] (open! id {} content))
|
34 | 41 | ([id opts content]
|
35 | 42 | ;; TODO: consider calling v/transform-result
|
|
0 commit comments