Skip to content

Commit ec5d0ca

Browse files
committed
Fix remaining notebooks
1 parent ec569b6 commit ec5d0ca

File tree

2 files changed

+40
-41
lines changed

2 files changed

+40
-41
lines changed

notebooks/controls.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;; # Controls! 🎛
22
^{:nextjournal.clerk/visibility #{:hide-ns}}
3-
(ns controls
3+
(ns ^:nextjournal.clerk/no-cache controls
44
(:require [clojure.string :as str]
55
[nextjournal.clerk :as clerk]))
66

notebooks/git.clj

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
(:require [nextjournal.clerk :as clerk]
55
[clj-jgit.porcelain :as cg]
66
[clj-jgit.querying :as cgq]
7-
[clojure.set :as set]))
7+
[clojure.set :as set]
8+
[nextjournal.clerk.viewer :as v]))
89

910
^{:nextjournal.clerk/viewer :hide-result}
1011
(def clerk-repo
@@ -18,42 +19,40 @@
1819
(into [])))
1920

2021
(clerk/with-viewer
21-
{:pred map?
22-
:fetch-fn (fn [_ x] x)
23-
:transform-fn (fn [commits]
24-
(map (fn [c]
25-
(update (select-keys c [:id :changed_files :time])
26-
:time #(subs (str %) 4 10)))
27-
commits))
28-
:render-fn '(fn [commits]
29-
(v/html
30-
[:div.min-h-screen.py-6.flex.flex-col.justify-center.sm:py-12.font-sans
31-
[:div.py-3.sm:max-w-xl.sm:mx-auto.w-full.px-2.sm:px-0
32-
(into
33-
[:div.relative.text-gray-700.antialiased.text-xs
34-
[:div {:class "hidden sm:block w-1 bg-gray-300 absolute h-full left-1/2 transform -translate-x-1/2"}]]
35-
(mapv (fn [i c]
36-
[:div.mt-6.sm:mt-0.sm:mb-12 {:id (:id c)}
37-
[:div.flex.flex-col.sm:flex-row.items-center
38-
[:div {:class "bg-white w-12 h-12 absolute left-1/2 -translate-y-4 sm:translate-y-0 transform -translate-x-1/2 flex items-center justify-center"}
39-
[:svg.h-10.w-12.pl-2.text-gray-500 {:xmlns "http://www.w3.org/2000/svg"
40-
:fill "none"
41-
:viewbox "0 0 32 32"
42-
:stroke "currentColor"}
43-
[:path {:transform "translate(5,0)"
44-
:stroke-width "2"
45-
:d "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"}]
46-
[:text.font-sans {:x 0 :y 36 :fill "currentColor"} (:time c)]]]
47-
[:div {:class (str "flex " (if (even? i) "justify-start" "justify-end")
48-
" w-full mx-auto items-center")}
49-
[:div {:class (str "w-full sm:w-1/2 " (if (even? i) "sm:pr-8" "sm:pl-8"))}
50-
(into
51-
[:div {:class "p-4 bg-white rounded shadow"}]
52-
(mapv (fn [[filename status]]
53-
[:span {:class (cond (= status :add) "text-lime-500"
54-
(= status :delete) "text-rose-600"
55-
:else "black")} filename [:br]])
56-
(:changed_files c)))]]]])
57-
(range)
58-
commits))]]))}
59-
commits)
22+
{:transform-fn (comp v/mark-presented
23+
(v/update-val (partial map
24+
(fn [c]
25+
(update (select-keys c [:id :changed_files :time])
26+
:time #(subs (str %) 4 10))))))
27+
:render-fn '(fn [commits]
28+
(v/html
29+
[:div.min-h-screen.py-6.flex.flex-col.justify-center.sm:py-12.font-sans
30+
[:div.py-3.sm:max-w-xl.sm:mx-auto.w-full.px-2.sm:px-0
31+
(into
32+
[:div.relative.text-gray-700.antialiased.text-xs
33+
[:div {:class "hidden sm:block w-1 bg-gray-300 absolute h-full left-1/2 transform -translate-x-1/2"}]]
34+
(mapv (fn [i c]
35+
[:div.mt-6.sm:mt-0.sm:mb-12 {:id (:id c)}
36+
[:div.flex.flex-col.sm:flex-row.items-center
37+
[:div {:class "bg-white w-12 h-12 absolute left-1/2 -translate-y-4 sm:translate-y-0 transform -translate-x-1/2 flex items-center justify-center"}
38+
[:svg.h-10.w-12.pl-2.text-gray-500 {:xmlns "http://www.w3.org/2000/svg"
39+
:fill "none"
40+
:viewbox "0 0 32 32"
41+
:stroke "currentColor"}
42+
[:path {:transform "translate(5,0)"
43+
:stroke-width "2"
44+
:d "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"}]
45+
[:text.font-sans {:x 0 :y 36 :fill "currentColor"} (:time c)]]]
46+
[:div {:class (str "flex " (if (even? i) "justify-start" "justify-end")
47+
" w-full mx-auto items-center")}
48+
[:div {:class (str "w-full sm:w-1/2 " (if (even? i) "sm:pr-8" "sm:pl-8"))}
49+
(into
50+
[:div {:class "p-4 bg-white rounded shadow"}]
51+
(mapv (fn [[filename status]]
52+
[:span {:class (cond (= status :add) "text-lime-500"
53+
(= status :delete) "text-rose-600"
54+
:else "black")} filename [:br]])
55+
(:changed_files c)))]]]])
56+
(range)
57+
commits))]]))}
58+
commits)

0 commit comments

Comments
 (0)