0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 09:08:31 -05:00

Parametrize recent colors component.

This commit is contained in:
Andrey Antukh 2016-01-21 00:13:43 +02:00
parent e3ebdb68b2
commit f786b8acab

View file

@ -42,19 +42,18 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn- recent-colors-render
[own {:keys [page id] :as shape}]
[own {:keys [page id] :as shape} callback]
(let [shapes-by-id (rum/react shapes-by-id)
shapes (->> (vals shapes-by-id)
(filter #(= (:page %) page)))
colors (calculate-colors shapes)
on-click #(rs/emit! (dw/update-shape-fill id {:fill %}))]
colors (calculate-colors shapes)]
(html
[:div
[:span "Recent colors"]
[:div.row-flex
(for [color colors]
[:span.color-th {:style {:background color}
:on-click (partial on-click color)}])
:on-click (partial callback color)}])
(for [i (range (- 5 (count colors)))]
[:span.color-th])