MediaAttachmentGrid: fix the vids scale

This commit is contained in:
thislight 2024-10-29 19:26:32 +08:00
parent 73a56357d9
commit 41d15887a7
No known key found for this signature in database
GPG key ID: A50F9451AC56A63E

View file

@ -138,6 +138,16 @@ const MediaAttachmentGrid: Component<{
);
};
const style = () => {
return Object.assign(
{
width: `${size().width}px`,
height: `${size().height}px`,
},
accentColor ? { "--media-color-accent": accentColor } : {},
);
};
switch (item.type) {
case "image":
return (
@ -148,13 +158,7 @@ const MediaAttachmentGrid: Component<{
alt={item.description || undefined}
onClick={[openViewerFor, index()]}
loading="lazy"
style={Object.assign(
{
width: `${size().width}px`,
height: `${size().height}px`,
},
accentColor ? { "--media-color-accent": accentColor } : {},
)}
style={style()}
></img>
);
case "video":
@ -167,6 +171,7 @@ const MediaAttachmentGrid: Component<{
poster={item.previewUrl}
width={width}
height={height}
style={style()}
/>
);
case "gifv":
@ -180,6 +185,7 @@ const MediaAttachmentGrid: Component<{
poster={item.previewUrl}
width={width}
height={height}
style={style()}
/>
);