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:
parent
e3ebdb68b2
commit
f786b8acab
1 changed files with 3 additions and 4 deletions
|
@ -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])
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue