diff --git a/src/timelines/MediaAttachmentGrid.tsx b/src/timelines/MediaAttachmentGrid.tsx index 546340a..86cbd5c 100644 --- a/src/timelines/MediaAttachmentGrid.tsx +++ b/src/timelines/MediaAttachmentGrid.tsx @@ -64,28 +64,29 @@ const MediaAttachmentGrid: Component<{ > {(item, index) => { + const [loaded, setLoaded] = createSignal(false) const width = item.meta?.small?.width; const height = item.meta?.small?.height; const aspectRatio = item.meta?.small?.aspect; const maxHeight = vh35(); const realHeight = height && height > maxHeight ? maxHeight : height; const realWidth = - height && height > maxHeight - ? maxHeight * (aspectRatio ?? 1) + width && height && height > maxHeight + ? maxHeight / (aspectRatio ?? 1) : width; - const style = { + const style = () => loaded() ? undefined : { width: realWidth ? `${realWidth}px` : undefined, height: realHeight ? `${realHeight}px` : undefined, - "aspect-ratio": aspectRatio?.toString(), }; switch (item.type) { case "image": return ( {item.description ); @@ -93,8 +94,10 @@ const MediaAttachmentGrid: Component<{ return (