mirror of
https://github.com/penpot/penpot.git
synced 2025-01-20 13:42:59 -05:00
♻ PR Feedback
This commit is contained in:
parent
53229c03d6
commit
656afa8a35
1 changed files with 29 additions and 28 deletions
|
@ -72,9 +72,11 @@
|
||||||
(st/emit!
|
(st/emit!
|
||||||
(wdt/show-token-set-context-menu
|
(wdt/show-token-set-context-menu
|
||||||
{:position (dom/get-client-position event)
|
{:position (dom/get-client-position event)
|
||||||
:prefixed-set-path tree-path})))))]
|
:prefixed-set-path tree-path})))))
|
||||||
[:div {;; :ref dref
|
on-click (fn [event]
|
||||||
:role "button"
|
(.stopPropagation event)
|
||||||
|
(swap! collapsed? not))]
|
||||||
|
[:div {:role "button"
|
||||||
:data-testid "tokens-set-group-item"
|
:data-testid "tokens-set-group-item"
|
||||||
:style {"--tree-depth" tree-depth}
|
:style {"--tree-depth" tree-depth}
|
||||||
:class (stl/css-case :set-item-container true
|
:class (stl/css-case :set-item-container true
|
||||||
|
@ -83,18 +85,17 @@
|
||||||
:on-context-menu on-context-menu}
|
:on-context-menu on-context-menu}
|
||||||
[:> icon-button*
|
[:> icon-button*
|
||||||
{:class (stl/css :set-item-group-collapse-button)
|
{:class (stl/css :set-item-group-collapse-button)
|
||||||
:on-click (fn [event]
|
:on-click on-click
|
||||||
(.stopPropagation event)
|
|
||||||
(swap! collapsed? not))
|
|
||||||
:aria-label (tr "labels.collapse")
|
:aria-label (tr "labels.collapse")
|
||||||
:icon (if @collapsed? "arrow-right" "arrow-down")
|
:icon (if @collapsed? "arrow-right" "arrow-down")
|
||||||
:variant "action"}]
|
:variant "action"}]
|
||||||
(if editing?'
|
(if editing?'
|
||||||
[:& editing-label
|
(let [on-submit #(on-edit-submit)]
|
||||||
{:default-value label
|
[:& editing-label
|
||||||
:on-cancel on-edit-reset
|
{:default-value label
|
||||||
:on-create on-edit-reset
|
:on-cancel on-edit-reset
|
||||||
:on-submit #(on-edit-submit)}]
|
:on-create on-edit-reset
|
||||||
|
:on-submit on-submit}])
|
||||||
[:div {:class (stl/css :set-name)
|
[:div {:class (stl/css :set-name)
|
||||||
:on-double-click #(on-edit tree-path)}
|
:on-double-click #(on-edit tree-path)}
|
||||||
label])]))
|
label])]))
|
||||||
|
@ -122,8 +123,7 @@
|
||||||
(wdt/show-token-set-context-menu
|
(wdt/show-token-set-context-menu
|
||||||
{:position (dom/get-client-position event)
|
{:position (dom/get-client-position event)
|
||||||
:prefixed-set-path tree-path})))))]
|
:prefixed-set-path tree-path})))))]
|
||||||
[:div {;; :ref dref
|
[:div {:role "button"
|
||||||
:role "button"
|
|
||||||
:data-testid "tokens-set-item"
|
:data-testid "tokens-set-item"
|
||||||
:style {"--tree-depth" tree-depth}
|
:style {"--tree-depth" tree-depth}
|
||||||
:class (stl/css-case :set-item-container true
|
:class (stl/css-case :set-item-container true
|
||||||
|
@ -141,21 +141,22 @@
|
||||||
:on-cancel on-edit-reset
|
:on-cancel on-edit-reset
|
||||||
:on-create on-edit-reset
|
:on-create on-edit-reset
|
||||||
:on-submit #(on-edit-submit set-name (ctob/update-name set %))}]
|
:on-submit #(on-edit-submit set-name (ctob/update-name set %))}]
|
||||||
[:*
|
(let [on-checkbox-click (fn [event]
|
||||||
[:div {:class (stl/css :set-name)
|
(dom/stop-propagation event)
|
||||||
:on-double-click #(on-edit tree-path)}
|
(on-toggle set-name))]
|
||||||
label]
|
[:*
|
||||||
[:button {:type "button"
|
[:div {:class (stl/css :set-name)
|
||||||
:on-click (fn [event]
|
:on-double-click #(on-edit tree-path)}
|
||||||
(dom/stop-propagation event)
|
label]
|
||||||
(on-toggle set-name))
|
[:button {:type "button"
|
||||||
:class (stl/css-case :checkbox-style true
|
:on-click on-checkbox-click
|
||||||
:checkbox-checked-style active?')}
|
:class (stl/css-case :checkbox-style true
|
||||||
(when active?'
|
:checkbox-checked-style active?')}
|
||||||
[:> icon* {:aria-label (tr "workspace.token.select-set")
|
(when active?'
|
||||||
:class (stl/css :check-icon)
|
[:> icon* {:aria-label (tr "workspace.token.select-set")
|
||||||
:size "s"
|
:class (stl/css :check-icon)
|
||||||
:id ic/tick}])]])]))
|
:size "s"
|
||||||
|
:id ic/tick}])]]))]))
|
||||||
|
|
||||||
(mf/defc sets-tree
|
(mf/defc sets-tree
|
||||||
[{:keys [set-path set-node tree-depth tree-path on-select selected? on-toggle active? editing? on-edit on-edit-reset on-edit-submit]
|
[{:keys [set-path set-node tree-depth tree-path on-select selected? on-toggle active? editing? on-edit on-edit-reset on-edit-submit]
|
||||||
|
|
Loading…
Add table
Reference in a new issue