zebra striping + single table for column-per-location

This commit is contained in:
2022-04-04 15:27:56 -07:00
parent 52bd8b5671
commit 982a0f3bed
3 changed files with 139 additions and 81 deletions

View File

@@ -38,6 +38,10 @@
(:color c) (assoc-in [:style :color] (str "rgb("
(str/join ","
(:color c))
")"))
(:bg-color c) (assoc-in [:style :background-color] (str "rgb("
(str/join ","
(:bg-color c))
")")))
cell-contents]))
@@ -68,7 +72,14 @@
(for [[i row] (map vector (range) (:rows table))]
^{:key i}
[:tr
(for [[i c] (map vector (range) (take cell-count (concat row (repeat nil))))]
(for [[i c] (map vector (range) (take cell-count
(reduce
(fn [[acc cnt] cur]
(if (>= (+ cnt (:colspan cur 1)) cell-count)
(reduced (conj acc cur))
[(conj acc cur) (+ cnt (:colspan cur 1))]))
[[] 0]
(concat row (repeat nil)))))]
^{:key i}
[cell {:click-event click-event} c])]))
(conj ^{:key "last"}