diff --git a/frontend/resources/styles/main/partials/sidebar-element-options.scss b/frontend/resources/styles/main/partials/sidebar-element-options.scss index 3070777fd..2616a51f7 100644 --- a/frontend/resources/styles/main/partials/sidebar-element-options.scss +++ b/frontend/resources/styles/main/partials/sidebar-element-options.scss @@ -73,18 +73,6 @@ width: 100%; align-items: center; justify-content: space-between; - - svg { - height: 8px; - width: 8px; - fill: $color-gray-20; - margin-right: 1rem; - transform: rotate(180deg); - } - - &.back { - cursor: pointer; - } } } @@ -2587,6 +2575,23 @@ } } +.component-block-title { + border: none; + background: none; + + svg { + height: 8px; + width: 8px; + fill: $color-gray-20; + margin-right: 1rem; + transform: rotate(180deg); + } + + &.back { + cursor: pointer; + } +} + .component-swap { .search-block { margin: 0.7rem 0.5rem 0.2rem 0.2rem; diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs index 8718de05b..b11502287 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs @@ -387,9 +387,13 @@ (swap! state* update :menu-open not))) on-menu-close - (mf/use-callback + (mf/use-fn #(swap! state* assoc :menu-open false)) + on-component-back + (mf/use-fn + #(st/emit! :interrupt)) + menu-entries (cmm/generate-components-menu-entries shapes components-v2) show-menu? (seq menu-entries)] @@ -427,17 +431,25 @@ [:& component-annotation {:id id :shape shape :component component}])])] [:div.element-set - [:div.element-set-title {:class (stl/css-case :back swap-opened?) - :on-click #(when swap-opened? (st/emit! :interrupt))} - [:div - (when swap-opened? - [:span - i/arrow-slide]) - [:span (tr "workspace.options.component")]] - (when-not multi - [:span (if main-instance? - (tr "workspace.options.component.main") - (tr "workspace.options.component.copy"))])] + (if swap-opened? + [:button.element-set-title.component-block-title {:class (stl/css-case :back swap-opened?) + :on-click on-component-back} + [:div + [:span i/arrow-slide] + [:span (tr "workspace.options.component")]] + + (when-not multi + [:span (if main-instance? + (tr "workspace.options.component.main") + (tr "workspace.options.component.copy"))])] + [:div.element-set-title + [:span (tr "workspace.options.component")] + (when-not multi + [:span (if main-instance? + (tr "workspace.options.component.main") + (tr "workspace.options.component.copy"))])]) + + [:div.element-set-content [:div.row-flex.component-row {:class (stl/css-case :copy can-swap?)