mirror of
https://github.com/penpot/penpot.git
synced 2025-07-09 20:57:53 +02: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))
|
(l/derived #(some-> % ctob/get-theme-groups) tokens-lib))
|
||||||
|
|
||||||
(defn workspace-token-theme
|
(defn workspace-token-theme
|
||||||
[id]
|
[group name]
|
||||||
(l/derived #(wtts/get-workspace-theme id %) st/state))
|
(l/derived
|
||||||
|
(fn [lib]
|
||||||
|
(when lib
|
||||||
|
(ctob/get-theme lib group name)))
|
||||||
|
tokens-lib))
|
||||||
|
|
||||||
|
;; Old
|
||||||
|
|
||||||
(def workspace-active-theme-ids
|
(def workspace-active-theme-ids
|
||||||
(l/derived wtts/get-active-theme-ids st/state))
|
(l/derived wtts/get-active-theme-ids st/state))
|
||||||
|
|
|
@ -62,7 +62,8 @@
|
||||||
(dom/prevent-default e)
|
(dom/prevent-default e)
|
||||||
(dom/stop-propagation e)
|
(dom/stop-propagation e)
|
||||||
(set-state (fn [_] {:type :edit-theme
|
(set-state (fn [_] {:type :edit-theme
|
||||||
:theme-id (:id theme)})))]
|
:theme-id (:id theme)
|
||||||
|
:theme-path [(:id theme) (:group theme) (:name theme)]})))]
|
||||||
[:div
|
[:div
|
||||||
[:ul {:class (stl/css :theme-group-wrapper)}
|
[:ul {:class (stl/css :theme-group-wrapper)}
|
||||||
(for [[group themes] themes]
|
(for [[group themes] themes]
|
||||||
|
@ -212,9 +213,10 @@
|
||||||
|
|
||||||
(mf/defc controlled-edit-theme
|
(mf/defc controlled-edit-theme
|
||||||
[{:keys [state set-state]}]
|
[{: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)
|
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)]
|
theme-groups (mf/deref refs/workspace-token-theme-groups)]
|
||||||
[:& edit-theme
|
[:& edit-theme
|
||||||
{:token-sets token-sets
|
{:token-sets token-sets
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue