MediaAttachmentGrid: optimize preview layout (#11)

This commit is contained in:
thislight 2024-09-14 20:09:54 +08:00
parent 724eb17391
commit bf7e694e00
No known key found for this signature in database
GPG key ID: A50F9451AC56A63E
2 changed files with 15 additions and 6 deletions

View file

@ -13,12 +13,12 @@ const MediaAttachmentGrid: Component<{
const gridTemplateColumns = () => {
const l = props.attachments.length;
if (l < 2) {
return "1fr";
return "minmax(40px, auto)";
}
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) => {