mirror of
https://github.com/penpot/penpot.git
synced 2025-02-09 08:38:15 -05:00
🐛 Fix asset list UI
This commit is contained in:
parent
65f7c9cbbf
commit
30a53252f8
4 changed files with 54 additions and 62 deletions
|
@ -336,7 +336,7 @@
|
||||||
;; used to render thumbnails on assets panel.
|
;; used to render thumbnails on assets panel.
|
||||||
(mf/defc component-svg
|
(mf/defc component-svg
|
||||||
{::mf/wrap [mf/memo #(mf/deferred % ts/idle-then-raf)]}
|
{::mf/wrap [mf/memo #(mf/deferred % ts/idle-then-raf)]}
|
||||||
[{:keys [objects root-shape show-grids? zoom] :or {zoom 1} :as props}]
|
[{:keys [objects root-shape show-grids? zoom class] :or {zoom 1} :as props}]
|
||||||
(when root-shape
|
(when root-shape
|
||||||
(let [root-shape-id (:id root-shape)
|
(let [root-shape-id (:id root-shape)
|
||||||
include-metadata (mf/use-ctx export/include-metadata-ctx)
|
include-metadata (mf/use-ctx export/include-metadata-ctx)
|
||||||
|
@ -373,6 +373,7 @@
|
||||||
:width (ust/format-precision width viewbox-decimal-precision)
|
:width (ust/format-precision width viewbox-decimal-precision)
|
||||||
:height (ust/format-precision height viewbox-decimal-precision)
|
:height (ust/format-precision height viewbox-decimal-precision)
|
||||||
:version "1.1"
|
:version "1.1"
|
||||||
|
:class class
|
||||||
:xmlns "http://www.w3.org/2000/svg"
|
:xmlns "http://www.w3.org/2000/svg"
|
||||||
:xmlnsXlink "http://www.w3.org/1999/xlink"
|
:xmlnsXlink "http://www.w3.org/1999/xlink"
|
||||||
:xmlns:penpot (when include-metadata "https://penpot.app/xmlns")
|
:xmlns:penpot (when include-metadata "https://penpot.app/xmlns")
|
||||||
|
@ -388,7 +389,7 @@
|
||||||
|
|
||||||
(mf/defc component-svg-thumbnail
|
(mf/defc component-svg-thumbnail
|
||||||
{::mf/wrap [mf/memo #(mf/deferred % ts/idle-then-raf)]}
|
{::mf/wrap [mf/memo #(mf/deferred % ts/idle-then-raf)]}
|
||||||
[{:keys [thumbnail-uri on-error show-grids?
|
[{:keys [thumbnail-uri on-error show-grids? class
|
||||||
objects root-shape zoom] :or {zoom 1} :as props}]
|
objects root-shape zoom] :or {zoom 1} :as props}]
|
||||||
|
|
||||||
(when root-shape
|
(when root-shape
|
||||||
|
@ -421,6 +422,7 @@
|
||||||
:width (ust/format-precision width-zoom viewbox-decimal-precision)
|
:width (ust/format-precision width-zoom viewbox-decimal-precision)
|
||||||
:height (ust/format-precision height-zoom viewbox-decimal-precision)
|
:height (ust/format-precision height-zoom viewbox-decimal-precision)
|
||||||
:version "1.1"
|
:version "1.1"
|
||||||
|
:class class
|
||||||
:xmlns "http://www.w3.org/2000/svg"
|
:xmlns "http://www.w3.org/2000/svg"
|
||||||
:xmlnsXlink "http://www.w3.org/1999/xlink"
|
:xmlnsXlink "http://www.w3.org/1999/xlink"
|
||||||
:fill "none"}
|
:fill "none"}
|
||||||
|
|
|
@ -281,7 +281,7 @@
|
||||||
(mf/defc component-item-thumbnail
|
(mf/defc component-item-thumbnail
|
||||||
"Component that renders the thumbnail image or the original SVG."
|
"Component that renders the thumbnail image or the original SVG."
|
||||||
{::mf/wrap-props false}
|
{::mf/wrap-props false}
|
||||||
[{:keys [file-id root-shape component container]}]
|
[{:keys [file-id root-shape component container class]}]
|
||||||
(let [retry (mf/use-state 0)
|
(let [retry (mf/use-state 0)
|
||||||
thumbnail-uri (get-component-thumbnail-uri file-id component)
|
thumbnail-uri (get-component-thumbnail-uri file-id component)
|
||||||
handle-error
|
handle-error
|
||||||
|
@ -294,6 +294,7 @@
|
||||||
(if (some? thumbnail-uri)
|
(if (some? thumbnail-uri)
|
||||||
[:& component-svg-thumbnail
|
[:& component-svg-thumbnail
|
||||||
{:thumbnail-uri thumbnail-uri
|
{:thumbnail-uri thumbnail-uri
|
||||||
|
:class class
|
||||||
:on-error handle-error
|
:on-error handle-error
|
||||||
:root-shape root-shape
|
:root-shape root-shape
|
||||||
:objects (:objects container)
|
:objects (:objects container)
|
||||||
|
@ -301,6 +302,7 @@
|
||||||
|
|
||||||
[:& component-svg
|
[:& component-svg
|
||||||
{:root-shape root-shape
|
{:root-shape root-shape
|
||||||
|
:class class
|
||||||
:objects (:objects container)
|
:objects (:objects container)
|
||||||
:show-grids? true}])))
|
:show-grids? true}])))
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,8 @@
|
||||||
|
|
||||||
(when visible?
|
(when visible?
|
||||||
[:& cmm/component-item-thumbnail {:file-id file-id
|
[:& cmm/component-item-thumbnail {:file-id file-id
|
||||||
:class (stl/css :thumbnail)
|
:class (stl/css-case :thumbnail true
|
||||||
|
:asset-list-thumbnail (not listing-thumbs?))
|
||||||
:root-shape root-shape
|
:root-shape root-shape
|
||||||
:component component
|
:component component
|
||||||
:container container}])])]))
|
:container container}])])]))
|
||||||
|
|
|
@ -26,14 +26,6 @@
|
||||||
background-color: var(--assets-component-background-color);
|
background-color: var(--assets-component-background-color);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
img {
|
|
||||||
height: auto;
|
|
||||||
width: auto;
|
|
||||||
max-height: 100%;
|
|
||||||
max-width: 100%;
|
|
||||||
pointer-events: none;
|
|
||||||
border: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cell-name {
|
.cell-name {
|
||||||
@include titleTipography;
|
@include titleTipography;
|
||||||
|
@ -84,6 +76,8 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
|
pointer-events: none;
|
||||||
|
border: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-placeholder {
|
.grid-placeholder {
|
||||||
|
@ -96,10 +90,13 @@
|
||||||
.asset-enum {
|
.asset-enum {
|
||||||
margin: 0 $s-12;
|
margin: 0 $s-12;
|
||||||
}
|
}
|
||||||
|
|
||||||
.enum-item {
|
.enum-item {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: grid;
|
||||||
|
grid-template-columns: auto 1fr;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
column-gap: $s-8;
|
||||||
height: $s-36;
|
height: $s-36;
|
||||||
margin-bottom: $s-4;
|
margin-bottom: $s-4;
|
||||||
padding: $s-2;
|
padding: $s-2;
|
||||||
|
@ -107,55 +104,6 @@
|
||||||
background-color: var(--assets-item-background-color);
|
background-color: var(--assets-item-background-color);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
svg,
|
|
||||||
img {
|
|
||||||
@include flexCenter;
|
|
||||||
flex-shrink: 0;
|
|
||||||
padding: $s-2;
|
|
||||||
height: $s-32;
|
|
||||||
width: $s-32;
|
|
||||||
border-radius: $br-6;
|
|
||||||
background-color: var(--color-foreground-secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.item-name {
|
|
||||||
@include titleTipography;
|
|
||||||
@include textEllipsis;
|
|
||||||
padding-left: $s-8;
|
|
||||||
color: var(--assets-item-name-foreground-color);
|
|
||||||
&.editing {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
height: $s-32;
|
|
||||||
border: $s-1 solid var(--input-border-color-focus);
|
|
||||||
border-radius: $br-8;
|
|
||||||
background-color: var(--input-background-color);
|
|
||||||
input {
|
|
||||||
@include textEllipsis;
|
|
||||||
@include titleTipography;
|
|
||||||
@include removeInputStyle;
|
|
||||||
flex-grow: 1;
|
|
||||||
height: $s-28;
|
|
||||||
max-width: calc(var(--parent-size) - (var(--depth) * var(--layer-indentation-size)));
|
|
||||||
padding-left: $s-6;
|
|
||||||
margin: 0;
|
|
||||||
border-radius: $br-8;
|
|
||||||
color: var(--input-foreground-color);
|
|
||||||
}
|
|
||||||
span {
|
|
||||||
@include flexCenter;
|
|
||||||
height: $s-28;
|
|
||||||
background-color: transparent;
|
|
||||||
border-radius: $br-8;
|
|
||||||
svg {
|
|
||||||
@extend .button-icon-small;
|
|
||||||
stroke: var(--input-foreground-color);
|
|
||||||
transform: rotate(90deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: var(--assets-item-background-color-hover);
|
background-color: var(--assets-item-background-color-hover);
|
||||||
.item-name {
|
.item-name {
|
||||||
|
@ -176,6 +124,45 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.item-name {
|
||||||
|
@include titleTipography;
|
||||||
|
@include textEllipsis;
|
||||||
|
order: 2;
|
||||||
|
color: var(--assets-item-name-foreground-color);
|
||||||
|
input {
|
||||||
|
@include textEllipsis;
|
||||||
|
@include titleTipography;
|
||||||
|
@include removeInputStyle;
|
||||||
|
height: $s-32;
|
||||||
|
padding: $s-4;
|
||||||
|
}
|
||||||
|
span {
|
||||||
|
display: flex;
|
||||||
|
place-items: center;
|
||||||
|
padding-inline-end: $s-4;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.editing {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr auto;
|
||||||
|
align-items: center;
|
||||||
|
column-gap: $s-8;
|
||||||
|
border: $s-1 solid var(--input-border-color-focus);
|
||||||
|
border-radius: $br-8;
|
||||||
|
background-color: var(--input-background-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.asset-list-thumbnail {
|
||||||
|
@include flexCenter;
|
||||||
|
flex-shrink: 0;
|
||||||
|
padding: $s-2;
|
||||||
|
height: $s-32;
|
||||||
|
width: $s-32;
|
||||||
|
border-radius: $br-6;
|
||||||
|
background-color: var(--assets-component-background-color);
|
||||||
|
}
|
||||||
|
|
||||||
.grid-placeholder {
|
.grid-placeholder {
|
||||||
height: $s-2;
|
height: $s-2;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
Loading…
Add table
Reference in a new issue