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