Adjust component title

This commit is contained in:
Luis de Dios 2025-08-19 09:43:35 +02:00
parent 643621a389
commit 7f2af1c355
2 changed files with 77 additions and 66 deletions

View File

@ -1032,6 +1032,9 @@
properties (mf/with-memo [data objects variant-id] properties (mf/with-memo [data objects variant-id]
(cfv/extract-properties-values data objects (:id shape))) (cfv/extract-properties-values data objects (:id shape)))
open* (mf/use-state true)
open? (deref open*)
menu-open* (mf/use-state false) menu-open* (mf/use-state false)
menu-open? (deref menu-open*) menu-open? (deref menu-open*)
@ -1041,6 +1044,10 @@
{:title (tr "workspace.shape.menu.add-variant") {:title (tr "workspace.shape.menu.add-variant")
:action #(st/emit! (dwv/add-new-variant (:id shape)))}] :action #(st/emit! (dwv/add-new-variant (:id shape)))}]
toggle-content
(mf/use-fn
#(swap! open* not))
on-menu-click on-menu-click
(mf/use-fn (mf/use-fn
(mf/deps menu-open* menu-open?) (mf/deps menu-open* menu-open?)
@ -1096,9 +1103,12 @@
[:div {:class (stl/css :element-title)} [:div {:class (stl/css :element-title)}
[:& title-bar {:collapsable false [:& title-bar {:collapsable true
:collapsed (not open?)
:on-collapsed toggle-content
:title (tr "workspace.options.component") :title (tr "workspace.options.component")
:class (stl/css :title-spacing-component)} :class (stl/css :title-spacing-component)
:title-class (stl/css :title-bar-variant)}
[:span {:class (stl/css :copy-text)} [:span {:class (stl/css :copy-text)}
(tr "workspace.options.component.main")] (tr "workspace.options.component.main")]
@ -1109,6 +1119,7 @@
:on-click on-click-variant-title-help :on-click on-click-variant-title-help
:icon "help"}]]]] :icon "help"}]]]]
(when open?
[:div {:class (stl/css :element-content)} [:div {:class (stl/css :element-content)}
[:div {:class (stl/css-case :component-wrapper true [:div {:class (stl/css-case :component-wrapper true
:with-actions (not multi?) :with-actions (not multi?)
@ -1183,4 +1194,4 @@
(tr "workspace.options.component.variant.duplicated.group.title")] (tr "workspace.options.component.variant.duplicated.group.title")]
[:button {:class (stl/css :variant-warning-button) [:button {:class (stl/css :variant-warning-button)
:on-click select-shapes-with-duplicated} :on-click select-shapes-with-duplicated}
(tr "workspace.options.component.variant.duplicated.group.locate")]]))]]))) (tr "workspace.options.component.variant.duplicated.group.locate")]]))])])))

View File

@ -34,7 +34,7 @@
.title-spacing-component { .title-spacing-component {
justify-content: flex-start; justify-content: flex-start;
gap: $s-4; gap: $s-8;
margin-bottom: $s-4; margin-bottom: $s-4;
} }