summaryrefslogtreecommitdiff
path: root/src/components.clj
blob: ed0444d1fe9f8afb10e2ab9126eae7129d054fd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
(ns components
  (:require [borkdude.html :refer [html]]
            [highlight :refer [highlight-styles]]))

(defn template [body]
  (html
   [:html
    {:style {:font-family "monospace"}}
    [:head
     [:style
      [:$
       (str
        (highlight-styles :code "default")
        (highlight-styles :output "default")
        "li { line-height: 1.6; }"
        "p { line-height: 1.6; font-family: Palatino; }"
        ".page-body p { max-width: 44em; }"
        ".page-body blockquote { max-width: 44em; }"
        ".highlight { padding: 1px; padding-left: 6px; }")]]
     [:meta {:charset "UTF-8"}]]
    [:body
     [:<> body]
     [:footer
      [:br]
      [:br]
      [:p "---"]
      [:span
       [:a {:href "https://github.com/telekid/jakezerrer"} "page src"]
       " | "
       [:a {:href "mailto:contact@jakezerrer.com?subject=Blog post"} "contact me"]]]]]))

(defn page [body]
  (template
   (html
    [:<>
     [:p [:a {:href "/"} "< home"]]
     [:div {:class "page-body"}
      body]])))

(defn blockquote [body [from to]]
  (html
   [:figure
    {:style {:margin-left "0" :margin-bottom "2"}}
    [:blockquote
     body]
    [:figcaption
     (html
      (if (nil? to)
        (html [:<> (str "p. " from)])
        (html [:<> (str "pp. " from "-" to)])))]]))