MediaAttachmentGrid: optimize preview layout (#11)
This commit is contained in:
parent
724eb17391
commit
bf7e694e00
2 changed files with 15 additions and 6 deletions
|
@ -13,12 +13,12 @@ const MediaAttachmentGrid: Component<{
|
||||||
const gridTemplateColumns = () => {
|
const gridTemplateColumns = () => {
|
||||||
const l = props.attachments.length;
|
const l = props.attachments.length;
|
||||||
if (l < 2) {
|
if (l < 2) {
|
||||||
return "1fr";
|
return "minmax(40px, auto)";
|
||||||
}
|
}
|
||||||
if (l < 4) {
|
if (l < 4) {
|
||||||
return "repeat(2, 1fr)";
|
return "repeat(2, minmax(40px, auto))";
|
||||||
}
|
}
|
||||||
return "repeat(3, 1fr)";
|
return "repeat(3, minmax(40px, auto))";
|
||||||
};
|
};
|
||||||
|
|
||||||
const openViewerFor = (index: number) => {
|
const openViewerFor = (index: number) => {
|
||||||
|
|
|
@ -228,10 +228,19 @@
|
||||||
> :where(img) {
|
> :where(img) {
|
||||||
max-height: 35vh;
|
max-height: 35vh;
|
||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
object-fit: none;
|
object-fit: contain;
|
||||||
width: 100%;
|
max-width: 100%;
|
||||||
background-color: var(--tutu-color-surface-d);
|
background-color: var(--tutu-color-surface-d);
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
transition: border-color 220ms var(--tutu-anim-curve-std),
|
||||||
|
box-shadow 220ms var(--tutu-anim-curve-std);
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus-visible {
|
||||||
|
border: 1px solid var(--tutu-color-surface-dd);
|
||||||
|
box-shadow: var(--tutu-shadow-e1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue