mirror of
https://github.com/penpot/penpot.git
synced 2025-07-28 13:37:19 +02:00
🐛 problem with palettes
This commit is contained in:
parent
55c85c0d5c
commit
07fb644e07
1 changed files with 62 additions and 60 deletions
|
@ -30,7 +30,7 @@
|
|||
|
||||
(defn selected-items-ref
|
||||
[library-id]
|
||||
(->> #(get-in % [:library-items :palettes library-id])
|
||||
(-> #(get-in % [:library-items :palettes library-id])
|
||||
(l/derived st/state)))
|
||||
|
||||
(def selected-library-ref
|
||||
|
@ -56,14 +56,15 @@
|
|||
(mf/defc palette
|
||||
[{:keys [libraries left-sidebar?] :as props}]
|
||||
|
||||
(when (and libraries (-> libraries count (> 0)))
|
||||
(let [current-selection (or (mf/deref selected-library-ref) (-> libraries first :id))
|
||||
state (mf/use-state {:show-menu false })]
|
||||
|
||||
(mf/use-effect
|
||||
(mf/deps current-selection)
|
||||
#(st/emit! (dlib/retrieve-library-data :palettes current-selection)))
|
||||
#(when current-selection
|
||||
(st/emit! (dlib/retrieve-library-data :palettes current-selection))))
|
||||
|
||||
(let [items (-> current-selection selected-items-ref mf/deref)
|
||||
(let [items (or (mf/deref (selected-items-ref current-selection)) [])
|
||||
doc-width (.. js/document -documentElement -clientWidth)
|
||||
width (:width @state (* doc-width 0.84))
|
||||
offset (:offset @state 0)
|
||||
|
@ -124,7 +125,8 @@
|
|||
(for [item items]
|
||||
[:& palette-item {:color (:content item) :key (:id item)}])]]
|
||||
|
||||
[:span.right-arrow {:on-click on-right-arrow-click} i/arrow-slide]]))))
|
||||
[:span.right-arrow {:on-click on-right-arrow-click} i/arrow-slide]]))
|
||||
)
|
||||
|
||||
(mf/defc colorpalette
|
||||
[{:keys [left-sidebar?]}]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue