From 41d15887a73c4d801b74594f56902f3f9bec62a6 Mon Sep 17 00:00:00 2001 From: thislight Date: Tue, 29 Oct 2024 19:26:32 +0800 Subject: [PATCH] MediaAttachmentGrid: fix the vids scale --- src/timelines/MediaAttachmentGrid.tsx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/timelines/MediaAttachmentGrid.tsx b/src/timelines/MediaAttachmentGrid.tsx index dcc5af1..c018c89 100644 --- a/src/timelines/MediaAttachmentGrid.tsx +++ b/src/timelines/MediaAttachmentGrid.tsx @@ -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()} > ); 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()} /> );