mirror of
https://github.com/penpot/penpot.git
synced 2025-06-06 09:21:39 +02:00
🐛 Fix swap sidebar keeps opened for main component after making 'Restore main' or 'Show main'
This commit is contained in:
parent
34181d2855
commit
9d8b7bc25c
1 changed files with 14 additions and 20 deletions
|
@ -17,7 +17,6 @@
|
||||||
[app.main.data.workspace.specialized-panel :as dwsp]
|
[app.main.data.workspace.specialized-panel :as dwsp]
|
||||||
[app.main.refs :as refs]
|
[app.main.refs :as refs]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.ui.components.context-menu :refer [context-menu]]
|
|
||||||
[app.main.ui.components.dropdown :refer [dropdown]]
|
[app.main.ui.components.dropdown :refer [dropdown]]
|
||||||
[app.main.ui.components.radio-buttons :refer [radio-button radio-buttons]]
|
[app.main.ui.components.radio-buttons :refer [radio-button radio-buttons]]
|
||||||
[app.main.ui.components.search-bar :refer [search-bar]]
|
[app.main.ui.components.search-bar :refer [search-bar]]
|
||||||
|
@ -386,23 +385,19 @@
|
||||||
[:& component-group-item {:item item :on-enter-group on-enter-group}]))]]]))
|
[:& component-group-item {:item item :on-enter-group on-enter-group}]))]]]))
|
||||||
|
|
||||||
(mf/defc component-ctx-menu
|
(mf/defc component-ctx-menu
|
||||||
[{:keys [menu-entries on-close show type] :as props}]
|
[{:keys [menu-entries on-close show] :as props}]
|
||||||
(case type
|
(let [do-action
|
||||||
:context-menu
|
(fn [action event]
|
||||||
[:& context-menu {:on-close on-close
|
(dom/stop-propagation event)
|
||||||
:show show
|
(action))]
|
||||||
:options
|
[:& dropdown {:show show :on-close on-close}
|
||||||
(vec (for [entry menu-entries :when (not (nil? entry))]
|
[:ul {:class (stl/css :custom-select-dropdown)}
|
||||||
[(tr (:msg entry)) (:action entry)]))}]
|
(for [entry menu-entries :when (not (nil? entry))]
|
||||||
:dropdown
|
[:li {:key (uuid/next)
|
||||||
[:& dropdown {:show show :on-close on-close}
|
:class (stl/css :dropdown-element)
|
||||||
[:ul {:class (stl/css :custom-select-dropdown)}
|
:on-click (partial do-action (:action entry))}
|
||||||
(for [entry menu-entries :when (not (nil? entry))]
|
[:span {:class (stl/css :dropdown-label)}
|
||||||
[:li {:key (uuid/next)
|
(tr (:msg entry))]])]]))
|
||||||
:class (stl/css :dropdown-element)
|
|
||||||
:on-click (:action entry)}
|
|
||||||
[:span {:class (stl/css :dropdown-label)}
|
|
||||||
(tr (:msg entry))]])]]))
|
|
||||||
|
|
||||||
|
|
||||||
(mf/defc component-menu
|
(mf/defc component-menu
|
||||||
|
@ -491,8 +486,7 @@
|
||||||
|
|
||||||
[:& component-ctx-menu {:show menu-open?
|
[:& component-ctx-menu {:show menu-open?
|
||||||
:on-close on-menu-close
|
:on-close on-menu-close
|
||||||
:menu-entries menu-entries
|
:menu-entries menu-entries}]])
|
||||||
:type :dropdown}]])
|
|
||||||
(when (and can-swap? (not multi))
|
(when (and can-swap? (not multi))
|
||||||
[:div {:class (stl/css :component-parent-name)}
|
[:div {:class (stl/css :component-parent-name)}
|
||||||
(cfh/merge-path-item (:path component) (:name component))])]]
|
(cfh/merge-path-item (:path component) (:name component))])]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue