mirror of
https://github.com/penpot/penpot.git
synced 2026-08-01 19:06:18 +00:00
Parametrize recent colors component.
This commit is contained in:
parent
e3ebdb68b2
commit
f786b8acab
@ -42,19 +42,18 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defn- recent-colors-render
|
(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)
|
(let [shapes-by-id (rum/react shapes-by-id)
|
||||||
shapes (->> (vals shapes-by-id)
|
shapes (->> (vals shapes-by-id)
|
||||||
(filter #(= (:page %) page)))
|
(filter #(= (:page %) page)))
|
||||||
colors (calculate-colors shapes)
|
colors (calculate-colors shapes)]
|
||||||
on-click #(rs/emit! (dw/update-shape-fill id {:fill %}))]
|
|
||||||
(html
|
(html
|
||||||
[:div
|
[:div
|
||||||
[:span "Recent colors"]
|
[:span "Recent colors"]
|
||||||
[:div.row-flex
|
[:div.row-flex
|
||||||
(for [color colors]
|
(for [color colors]
|
||||||
[:span.color-th {:style {:background color}
|
[:span.color-th {:style {:background color}
|
||||||
:on-click (partial on-click color)}])
|
:on-click (partial callback color)}])
|
||||||
(for [i (range (- 5 (count colors)))]
|
(for [i (range (- 5 (count colors)))]
|
||||||
[:span.color-th])
|
[:span.color-th])
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user