mirror of
https://github.com/penpot/penpot.git
synced 2025-05-21 07:06:12 +02:00
Token theme deletion
This commit is contained in:
parent
844819a50c
commit
ec96e7918d
5 changed files with 20 additions and 17 deletions
|
@ -154,14 +154,14 @@
|
|||
(rx/of
|
||||
(dch/commit-changes changes))))))
|
||||
|
||||
(defn delete-token-theme [token-theme-id]
|
||||
(defn delete-token-theme [group name]
|
||||
(ptk/reify ::delete-token-theme
|
||||
ptk/WatchEvent
|
||||
(watch [it state _]
|
||||
(let [data (get state :workspace-data)
|
||||
changes (-> (pcb/empty-changes it)
|
||||
(pcb/with-library-data data)
|
||||
(pcb/delete-token-theme token-theme-id))]
|
||||
(pcb/delete-token-theme group name))]
|
||||
(rx/of
|
||||
(dch/commit-changes changes)
|
||||
(wtu/update-workspace-tokens))))))
|
||||
|
|
|
@ -70,9 +70,10 @@
|
|||
(when (seq group)
|
||||
[:span {:class (stl/css :theme-group-label)} group])
|
||||
[:ul {:class (stl/css :theme-group-rows-wrapper)}
|
||||
(for [[_ {:keys [id group name] :as theme}] themes
|
||||
:let [selected? (some? (get active-theme-ids (ctob/theme-path theme)))]]
|
||||
[:li {:key (str "token-theme-" id)
|
||||
(for [[_ {:keys [group name] :as theme}] themes
|
||||
:let [theme-id (ctob/theme-path theme)
|
||||
selected? (some? (get active-theme-ids theme-id))]]
|
||||
[:li {:key theme-id
|
||||
:class (stl/css :theme-row)}
|
||||
[:div {:class (stl/css :theme-row-left)}
|
||||
[:div {:on-click (fn [e]
|
||||
|
@ -97,7 +98,7 @@
|
|||
[:button {:on-click (fn [e]
|
||||
(dom/prevent-default e)
|
||||
(dom/stop-propagation e)
|
||||
(st/emit! (wdt/delete-token-theme id)))}
|
||||
(st/emit! (wdt/delete-token-theme group name)))}
|
||||
i/delete]]]])]])]
|
||||
[:div {:class (stl/css :button-footer)}
|
||||
[:button {:class (stl/css :create-theme-button)
|
||||
|
@ -195,7 +196,7 @@
|
|||
[:button {:class (stl/css :button-secondary)
|
||||
:type "button"
|
||||
:on-click (fn []
|
||||
(st/emit! (wdt/delete-token-theme (:id theme)))
|
||||
(st/emit! (wdt/delete-token-theme (:group theme) (:name theme)))
|
||||
(on-back))}
|
||||
"Delete"]
|
||||
[:div])
|
||||
|
|
|
@ -23,9 +23,10 @@
|
|||
[{:keys [themes active-theme-ids on-close grouped?]}]
|
||||
(when (seq themes)
|
||||
[:ul
|
||||
(for [[_ {:keys [id group name] :as theme}] themes
|
||||
:let [selected? (get active-theme-ids (ctob/theme-path theme))]]
|
||||
[:li {:key id
|
||||
(for [[_ {:keys [group name] :as theme}] themes
|
||||
:let [theme-id (ctob/theme-path theme)
|
||||
selected? (get active-theme-ids theme-id)]]
|
||||
[:li {:key theme-id
|
||||
:class (stl/css-case
|
||||
:checked-element true
|
||||
:sub-item grouped?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue