mirror of
https://github.com/penpot/penpot.git
synced 2025-02-08 08:09:14 -05:00
Update shapes on token set switch
This commit is contained in:
parent
587a2936e6
commit
1f0c1dbbe6
2 changed files with 12 additions and 4 deletions
|
@ -10,6 +10,7 @@
|
|||
[app.common.data :as d]
|
||||
[app.main.data.modal :as modal]
|
||||
[app.main.data.tokens :as dt]
|
||||
[app.main.data.tokens :as wdt]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.icons :as i]
|
||||
|
@ -20,6 +21,7 @@
|
|||
[app.main.ui.workspace.tokens.style-dictionary :as sd]
|
||||
[app.main.ui.workspace.tokens.token :as wtt]
|
||||
[app.main.ui.workspace.tokens.token-types :as wtty]
|
||||
[app.main.ui.workspace.tokens.update :as wtu]
|
||||
[app.util.dom :as dom]
|
||||
[cuerdas.core :as str]
|
||||
[okulary.core :as l]
|
||||
|
@ -148,7 +150,6 @@
|
|||
[_props]
|
||||
(let [selected-token-set-id (mf/deref refs/workspace-selected-token-set-id)
|
||||
token-sets (mf/deref refs/workspace-token-sets)]
|
||||
(js/console.log "token-sets" token-sets)
|
||||
[:div
|
||||
{:style {:display "flex"
|
||||
:flex-direction "column"
|
||||
|
@ -157,13 +158,19 @@
|
|||
"Token Sets"
|
||||
[:div
|
||||
{:style {:display "flex" :gap "10px"}}
|
||||
[:button "Create"]
|
||||
[:button
|
||||
{:on-click #(st/emit! (wdt/create-token-set nil))}
|
||||
"Create"]
|
||||
[:button "Delete"]]
|
||||
[:ul
|
||||
{:style {:list-style "disk"
|
||||
:margin-left "20px"}}
|
||||
(for [[_ {:keys [id name]}] token-sets]
|
||||
[:li {:style {:font-weight (when (= selected-token-set-id id) "bold")}}
|
||||
[:li {:style {:font-weight (when (= selected-token-set-id id) "bold")}
|
||||
:on-click (fn []
|
||||
(st/emit!
|
||||
(wdt/set-selected-token-set-id id)
|
||||
(wtu/update-workspace-tokens)))}
|
||||
name])]
|
||||
[:hr]]))
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
[app.main.refs :as refs]
|
||||
[app.main.ui.workspace.tokens.changes :as wtch]
|
||||
[app.main.ui.workspace.tokens.style-dictionary :as wtsd]
|
||||
[app.main.ui.workspace.tokens.token-set :as wtts]
|
||||
[beicon.v2.core :as rx]
|
||||
[clojure.data :as data]
|
||||
[clojure.set :as set]
|
||||
|
@ -120,7 +121,7 @@
|
|||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(->>
|
||||
(rx/from (wtsd/resolve-tokens+ (get-in state [:workspace-data :tokens])))
|
||||
(rx/from (wtsd/resolve-tokens+ (wtts/get-selected-token-set-tokens state)))
|
||||
(rx/mapcat
|
||||
(fn [sd-tokens]
|
||||
(let [undo-id (js/Symbol)]
|
||||
|
|
Loading…
Add table
Reference in a new issue