Browse code

Add license panel and styling

Joseph Weston authored on 05/12/2021 00:59:29
Showing 2 changed files
... ...
@@ -118,6 +118,12 @@
118 118
     kind-style
119 119
     [:section.description {:font-style :italic}])
120 120
 
121
+(defclass license-panel []
122
+    {}
123
+    title-style
124
+    [:ol.clauses>li {:margin-top :0.8rem}]
125
+    [:p :li {:font-size :0.8rem :line-height :0.9rem}])
126
+
121 127
 (defclass error-message []
122 128
     {:background-color (colorscheme :faded-red)
123 129
      :color (colorscheme :light0-hard)}
... ...
@@ -74,6 +74,13 @@
74 74
     (when (x :speed)
75 75
         (spaced (-> x :speed :quantity) (-> x :speed :unit))))
76 76
 
77
+(defn license-panel [license]
78
+    [:article {:class (styles/license-panel)}
79
+     [:h1 (license :license-name)]
80
+     [:p (license :preamble)]
81
+     (into [:ol.clauses] (->> license :clauses (map #(vector :li %))))
82
+     [:div.copyright-notice (->> license :copyright-notice (map #(vector :p %)))]])
83
+
77 84
 (defn spell-panel [spell]
78 85
       [:article {:class (styles/spell-panel)}
79 86
        [:h1 (spell :name)]
... ...
@@ -167,6 +174,7 @@
167 174
 
168 175
 (defn input [x] [:div.input x])
169 176
 
177
+(def is-license? :license-name)
170 178
 (def is-spell? #(some-> % :url (string/starts-with? "/api/spells")))
171 179
 (def is-equipment? #(some-> % :url (string/starts-with? "/api/equipment")))
172 180
 (def is-weapon? #(and (is-equipment? %) (-> % :equipment_category :index (= "weapon"))))
... ...
@@ -176,6 +184,7 @@
176 184
 (defn output [x]
177 185
     [:div.output
178 186
      (cond
187
+      (is-license? x) (license-panel x)
179 188
       (is-spell? x) (spell-panel x)
180 189
       (is-weapon? x) (weapon-panel x)
181 190
       (is-equipment? x) (equipment-panel x)