mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 06:58:58 -05:00
Merge pull request #5355 from penpot/azazeln28-fix-component-list-jumps
🐛 Fix component list jumps
This commit is contained in:
commit
ef3588d05f
3 changed files with 20 additions and 17 deletions
|
@ -338,7 +338,7 @@
|
|||
;; used to render thumbnails on assets panel.
|
||||
(mf/defc component-svg
|
||||
{::mf/wrap [mf/memo #(mf/deferred % ts/idle-then-raf)]}
|
||||
[{:keys [objects root-shape show-grids? zoom class] :or {zoom 1} :as props}]
|
||||
[{:keys [objects root-shape show-grids? is-hidden zoom class] :or {zoom 1} :as props}]
|
||||
(when root-shape
|
||||
(let [root-shape-id (:id root-shape)
|
||||
include-metadata (mf/use-ctx export/include-metadata-ctx)
|
||||
|
@ -381,13 +381,14 @@
|
|||
:xmlns:penpot (when include-metadata "https://penpot.app/xmlns")
|
||||
:fill "none"}
|
||||
|
||||
[:*
|
||||
[:> shape-container {:shape root-shape'}
|
||||
[:& (mf/provider muc/is-component?) {:value true}
|
||||
[:& root-shape-wrapper {:shape root-shape' :view-box vbox}]]]
|
||||
(when-not is-hidden
|
||||
[:*
|
||||
[:> shape-container {:shape root-shape'}
|
||||
[:& (mf/provider muc/is-component?) {:value true}
|
||||
[:& root-shape-wrapper {:shape root-shape' :view-box vbox}]]]
|
||||
|
||||
(when show-grids?
|
||||
[:& empty-grids {:root-shape-id root-shape-id :objects objects}])]])))
|
||||
(when show-grids?
|
||||
[:& empty-grids {:root-shape-id root-shape-id :objects objects}])])])))
|
||||
|
||||
(mf/defc component-svg-thumbnail
|
||||
{::mf/wrap [mf/memo #(mf/deferred % ts/idle-then-raf)]}
|
||||
|
|
|
@ -270,7 +270,7 @@
|
|||
(mf/defc component-item-thumbnail
|
||||
"Component that renders the thumbnail image or the original SVG."
|
||||
{::mf/props :obj}
|
||||
[{:keys [file-id root-shape component container class]}]
|
||||
[{:keys [file-id root-shape component container class is-hidden]}]
|
||||
(let [page-id (:main-instance-page component)
|
||||
root-id (:main-instance-id component)
|
||||
retry (mf/use-state 0)
|
||||
|
@ -290,7 +290,8 @@
|
|||
(when (< @retry 3)
|
||||
(inc retry))))]
|
||||
|
||||
(if (and (some? thumbnail-uri) (contains? cf/flags :component-thumbnails))
|
||||
(if (and (some? thumbnail-uri)
|
||||
(contains? cf/flags :component-thumbnails))
|
||||
[:& component-svg-thumbnail
|
||||
{:thumbnail-uri thumbnail-uri
|
||||
:class class
|
||||
|
@ -303,7 +304,8 @@
|
|||
{:root-shape root-shape
|
||||
:class class
|
||||
:objects (:objects container)
|
||||
:show-grids? true}])))
|
||||
:show-grids? true
|
||||
:is-hidden is-hidden}])))
|
||||
|
||||
(defn generate-components-menu-entries
|
||||
[shapes components-v2]
|
||||
|
|
|
@ -171,13 +171,13 @@
|
|||
(when ^boolean dragging?
|
||||
[:div {:class (stl/css :dragging)}])]
|
||||
|
||||
(when visible?
|
||||
[:& cmm/component-item-thumbnail {:file-id file-id
|
||||
:class (stl/css-case :thumbnail true
|
||||
:asset-list-thumbnail (not listing-thumbs?))
|
||||
:root-shape root-shape
|
||||
:component component
|
||||
:container container}])])]))
|
||||
[:& cmm/component-item-thumbnail {:file-id file-id
|
||||
:class (stl/css-case :thumbnail true
|
||||
:asset-list-thumbnail (not listing-thumbs?))
|
||||
:root-shape root-shape
|
||||
:component component
|
||||
:container container
|
||||
:is-hidden (not visible?)}]])]))
|
||||
|
||||
(mf/defc components-group
|
||||
{::mf/wrap-props false}
|
||||
|
|
Loading…
Add table
Reference in a new issue