mirror of
https://github.com/penpot/penpot.git
synced 2025-01-20 05:34:23 -05:00
⏪ Restore new sets input
This commit is contained in:
parent
a19d85fb10
commit
3afdc72a4e
2 changed files with 24 additions and 15 deletions
|
@ -30,7 +30,7 @@
|
|||
(defn on-update-token-set [set-name token-set]
|
||||
(st/emit! (wdt/update-token-set set-name token-set)))
|
||||
|
||||
(defn on-create-token-set [token-set]
|
||||
(defn on-create-token-set [_ token-set]
|
||||
(st/emit! (wdt/create-token-set token-set)))
|
||||
|
||||
(mf/defc editing-label
|
||||
|
@ -111,7 +111,7 @@
|
|||
(mf/defc sets-tree-set
|
||||
[{:keys [set label tree-depth tree-path selected? on-select active? on-toggle editing? on-edit on-edit-submit]}]
|
||||
(let [set-name (.-name set)
|
||||
{:keys [on-create on-reset] :as ctx} (sets-context/use-context)
|
||||
{:keys [on-reset] :as ctx} (sets-context/use-context)
|
||||
editing?' (editing? tree-path)
|
||||
active?' (active? set-name)
|
||||
on-click
|
||||
|
@ -242,15 +242,27 @@
|
|||
(empty? token-sets))
|
||||
[:> text* {:as "span" :typography "body-small" :class (stl/css :empty-state-message-sets)}
|
||||
(tr "workspace.token.no-sets-create")]
|
||||
[:& sets-tree
|
||||
{:set-node token-sets
|
||||
:selected? token-set-selected?
|
||||
:on-select on-select
|
||||
:active? token-set-active?
|
||||
:on-toggle on-toggle-token-set
|
||||
:editing? editing?
|
||||
:on-edit on-edit
|
||||
:on-edit-submit on-update-token-set}]))]))
|
||||
[:*
|
||||
[:& sets-tree
|
||||
{:set-node token-sets
|
||||
:selected? token-set-selected?
|
||||
:on-select on-select
|
||||
:active? token-set-active?
|
||||
:on-toggle on-toggle-token-set
|
||||
:editing? editing?
|
||||
:on-edit on-edit
|
||||
:on-edit-submit on-update-token-set}]
|
||||
(when new?
|
||||
[:& sets-tree-set
|
||||
{:set (ctob/make-token-set :name "")
|
||||
:label ""
|
||||
:selected? (constantly true)
|
||||
:active? (constantly true)
|
||||
:editing? (constantly true)
|
||||
:on-select (constantly nil)
|
||||
:on-edit (constantly nil)
|
||||
:on-edit-submit on-create-token-set
|
||||
:on-cancel on-reset}])]))]))
|
||||
|
||||
(mf/defc sets-list
|
||||
[{:keys []}]
|
||||
|
|
|
@ -205,10 +205,7 @@
|
|||
(let [{:keys [on-create new?]} (sets-context/use-context)
|
||||
on-click #(do
|
||||
(on-open)
|
||||
(let [set-path (some-> (js/prompt "Token Set Path")
|
||||
(str/trim))]
|
||||
(when-not (str/empty? set-path)
|
||||
(st/emit! (wdt/create-token-set {:name set-path})))))]
|
||||
(on-create))]
|
||||
(if (= style "inline")
|
||||
(when-not new?
|
||||
[:div {:class (stl/css :empty-sets-wrapper)}
|
||||
|
|
Loading…
Add table
Reference in a new issue