0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 06:02:32 -05:00

Replace sets

This commit is contained in:
Florian Schroedl 2024-09-23 15:18:46 +02:00
parent f5c122b0db
commit 4c327f38ef
2 changed files with 17 additions and 20 deletions

View file

@ -468,6 +468,9 @@
(def workspace-selected-token-set-id
(l/derived wtts/get-selected-token-set-id st/state))
(def workspace-ordered-token-sets
(l/derived #(or (some-> % ctob/get-sets) []) tokens-lib))
(dm/legacy
(def workspace-active-theme-ids
(l/derived wtts/get-active-theme-ids st/state))
@ -478,13 +481,6 @@
(def workspace-active-set-ids
(l/derived wtts/get-active-set-ids st/state))
(def workspace-ordered-token-sets
(l/derived
(fn [data]
(or (wtts/get-workspace-ordered-sets data) {}))
st/state
=))
(def workspace-active-theme-sets-tokens
(l/derived wtts/get-active-theme-sets-tokens-names-map st/state =))

View file

@ -146,20 +146,21 @@
:as _props}]
(let [{:keys [editing? new? on-edit on-create on-reset] :as ctx} (or context (sets-context/use-context))]
[:ul {:class (stl/css :sets-list)}
(for [[id token-set] token-sets]
(for [token-set token-sets]
(when token-set
[:& sets-tree {:key id
:token-set token-set
:token-set-selected? (if new? (constantly false) token-set-selected?)
:token-set-active? token-set-active?
:editing? editing?
:on-select on-select
:on-edit on-edit
:on-toggle on-toggle-token-set
:on-submit #(do
(on-update-token-set %)
(on-reset))
:on-cancel on-reset}]))
[:& sets-tree
{:key (:name token-set)
:token-set token-set
:token-set-selected? (if new? (constantly false) token-set-selected?)
:token-set-active? token-set-active?
:editing? editing?
:on-select on-select
:on-edit on-edit
:on-toggle on-toggle-token-set
:on-submit #(do
(on-update-token-set %)
(on-reset))
:on-cancel on-reset}]))
(when new?
[:& sets-tree {:token-set {:name ""}
:token-set-selected? (constantly true)