mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 08:50:57 -05:00
Merge pull request #3268 from penpot/superalex-file-libraries-colors-order
✨ Improve file libraries colors order
This commit is contained in:
commit
4947169a7c
2 changed files with 5 additions and 4 deletions
|
@ -118,7 +118,7 @@
|
|||
:on-close #(swap! state assoc :show-menu false)}
|
||||
[:ul.workspace-context-menu.palette-menu
|
||||
(for [{:keys [data id] :as library} (vals shared-libs)]
|
||||
(let [colors (-> data :colors vals)]
|
||||
(let [colors (->> data :colors vals (sort-by :name))]
|
||||
[:li.palette-library
|
||||
{:key (dm/str "library-" id)
|
||||
:on-click on-select-palette
|
||||
|
@ -126,7 +126,7 @@
|
|||
(when (= selected id) i/tick)
|
||||
[:div.library-name (str (:name library) " " (str/ffmt "(%)" (count colors)))]
|
||||
[:div.color-sample
|
||||
(for [[i {:keys [color]}] (map-indexed vector (take 7 colors))]
|
||||
(for [[i {:keys [color]}] (map-indexed vector colors)]
|
||||
[:& cb/color-bullet {:key (dm/str "color-" i)
|
||||
:color color}])]]))
|
||||
|
||||
|
@ -139,7 +139,7 @@
|
|||
(tr "workspace.libraries.colors.file-library")
|
||||
(str/ffmt " (%)" (count file-colors)))]
|
||||
[:div.color-sample
|
||||
(for [[i color] (map-indexed vector (take 7 (vals file-colors)))]
|
||||
(for [[i color] (map-indexed vector (take 7 (->> (vals file-colors) (sort-by :name))))]
|
||||
[:& cb/color-bullet {:key (dm/str "color-" i)
|
||||
:color color}])]]
|
||||
|
||||
|
|
|
@ -54,12 +54,13 @@
|
|||
(map #(if (map? %) % {:color %}) (reverse (or recent-colors [])))
|
||||
|
||||
(= @selected :file)
|
||||
(vals file-colors)
|
||||
(->> (vals file-colors) (sort-by :name))
|
||||
|
||||
:else ;; Library UUID
|
||||
(as-> @selected file-id
|
||||
(->> (get-in shared-libs [file-id :data :colors])
|
||||
(vals)
|
||||
(sort-by :name)
|
||||
(map #(assoc % :file-id file-id)))))]
|
||||
|
||||
(reset! current-colors (into [] (filter check-valid-color?) colors))))
|
||||
|
|
Loading…
Reference in a new issue