mirror of
https://github.com/penpot/penpot.git
synced 2025-06-11 09:51:39 +02:00
⚡ Add ::mf/props :obj to components menu sidebar
This commit is contained in:
parent
ef2160dbb6
commit
60962b58fe
1 changed files with 12 additions and 7 deletions
|
@ -34,7 +34,8 @@
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
|
|
||||||
(mf/defc component-annotation
|
(mf/defc component-annotation
|
||||||
[{:keys [id shape component] :as props}]
|
{::mf/props :obj}
|
||||||
|
[{:keys [id shape component]}]
|
||||||
(let [main-instance? (:main-instance shape)
|
(let [main-instance? (:main-instance shape)
|
||||||
component-id (:component-id shape)
|
component-id (:component-id shape)
|
||||||
annotation (:annotation component)
|
annotation (:annotation component)
|
||||||
|
@ -170,8 +171,8 @@
|
||||||
[:div {:class (stl/css :counter)} (str @size "/300")])]])))
|
[:div {:class (stl/css :counter)} (str @size "/300")])]])))
|
||||||
|
|
||||||
(mf/defc component-swap-item
|
(mf/defc component-swap-item
|
||||||
{::mf/wrap-props false}
|
{::mf/props :obj}
|
||||||
[{:keys [item loop shapes file-id root-shape container component-id is-search listing-thumbs] :as props}]
|
[{:keys [item loop shapes file-id root-shape container component-id is-search listing-thumbs]}]
|
||||||
(let [on-select-component
|
(let [on-select-component
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps shapes file-id item)
|
(mf/deps shapes file-id item)
|
||||||
|
@ -197,7 +198,8 @@
|
||||||
(if is-search (:full-name item) (:name item))]]))
|
(if is-search (:full-name item) (:name item))]]))
|
||||||
|
|
||||||
(mf/defc component-group-item
|
(mf/defc component-group-item
|
||||||
[{:keys [item on-enter-group] :as props}]
|
{::mf/props :obj}
|
||||||
|
[{:keys [item on-enter-group]}]
|
||||||
(let [group-name (:name item)
|
(let [group-name (:name item)
|
||||||
path (cfh/butlast-path-with-dots group-name)
|
path (cfh/butlast-path-with-dots group-name)
|
||||||
on-group-click #(on-enter-group group-name)]
|
on-group-click #(on-enter-group group-name)]
|
||||||
|
@ -216,7 +218,8 @@
|
||||||
i/arrow-refactor]]))
|
i/arrow-refactor]]))
|
||||||
|
|
||||||
(mf/defc component-swap
|
(mf/defc component-swap
|
||||||
[{:keys [shapes] :as props}]
|
{::mf/props :obj}
|
||||||
|
[{:keys [shapes]}]
|
||||||
(let [single? (= 1 (count shapes))
|
(let [single? (= 1 (count shapes))
|
||||||
shape (first shapes)
|
shape (first shapes)
|
||||||
current-file-id (mf/use-ctx ctx/current-file-id)
|
current-file-id (mf/use-ctx ctx/current-file-id)
|
||||||
|
@ -429,7 +432,8 @@
|
||||||
:on-enter-group on-enter-group}]))]]]]))
|
:on-enter-group on-enter-group}]))]]]]))
|
||||||
|
|
||||||
(mf/defc component-ctx-menu
|
(mf/defc component-ctx-menu
|
||||||
[{:keys [menu-entries on-close show main-instance] :as props}]
|
{::mf/props :obj}
|
||||||
|
[{:keys [menu-entries on-close show main-instance]}]
|
||||||
(let [do-action
|
(let [do-action
|
||||||
(fn [action event]
|
(fn [action event]
|
||||||
(dom/stop-propagation event)
|
(dom/stop-propagation event)
|
||||||
|
@ -446,7 +450,8 @@
|
||||||
(tr (:msg entry))]])]]))
|
(tr (:msg entry))]])]]))
|
||||||
|
|
||||||
(mf/defc component-menu
|
(mf/defc component-menu
|
||||||
[{:keys [shapes swap-opened?] :as props}]
|
{::mf/props :obj}
|
||||||
|
[{:keys [shapes swap-opened?]}]
|
||||||
(let [current-file-id (mf/use-ctx ctx/current-file-id)
|
(let [current-file-id (mf/use-ctx ctx/current-file-id)
|
||||||
components-v2 (mf/use-ctx ctx/components-v2)
|
components-v2 (mf/use-ctx ctx/components-v2)
|
||||||
workspace-data (deref refs/workspace-data)
|
workspace-data (deref refs/workspace-data)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue