mirror of
https://github.com/penpot/penpot.git
synced 2025-03-09 06:11:23 -05:00
Refactor: Use tokens-lib for getting tokens theme
This commit is contained in:
parent
6d75993fd7
commit
80e8903754
2 changed files with 13 additions and 5 deletions
|
@ -250,8 +250,14 @@
|
|||
(l/derived #(some-> % ctob/get-theme-groups) tokens-lib))
|
||||
|
||||
(defn workspace-token-theme
|
||||
[id]
|
||||
(l/derived #(wtts/get-workspace-theme id %) st/state))
|
||||
[group name]
|
||||
(l/derived
|
||||
(fn [lib]
|
||||
(when lib
|
||||
(ctob/get-theme lib group name)))
|
||||
tokens-lib))
|
||||
|
||||
;; Old
|
||||
|
||||
(def workspace-active-theme-ids
|
||||
(l/derived wtts/get-active-theme-ids st/state))
|
||||
|
|
|
@ -62,7 +62,8 @@
|
|||
(dom/prevent-default e)
|
||||
(dom/stop-propagation e)
|
||||
(set-state (fn [_] {:type :edit-theme
|
||||
:theme-id (:id theme)})))]
|
||||
:theme-id (:id theme)
|
||||
:theme-path [(:id theme) (:group theme) (:name theme)]})))]
|
||||
[:div
|
||||
[:ul {:class (stl/css :theme-group-wrapper)}
|
||||
(for [[group themes] themes]
|
||||
|
@ -212,9 +213,10 @@
|
|||
|
||||
(mf/defc controlled-edit-theme
|
||||
[{:keys [state set-state]}]
|
||||
(let [{:keys [theme-id]} @state
|
||||
(let [{:keys [theme-path]} @state
|
||||
[_ theme-group theme-name] theme-path
|
||||
token-sets (mf/deref refs/workspace-ordered-token-sets)
|
||||
theme (mf/deref (refs/workspace-token-theme theme-id))
|
||||
theme (mf/deref (refs/workspace-token-theme theme-group theme-name))
|
||||
theme-groups (mf/deref refs/workspace-token-theme-groups)]
|
||||
[:& edit-theme
|
||||
{:token-sets token-sets
|
||||
|
|
Loading…
Add table
Reference in a new issue