From fb1453b419b933de7d90d2d2d6766ad2df32987b Mon Sep 17 00:00:00 2001 From: Jonas Braathen Date: Thu, 15 Oct 2026 01:43:05 +0200 Subject: [PATCH] web: let next/image serve SVGs so they lazy-load instead of being preloaded --- .../components/blocks/ContactEntityBlock.tsx | 1 + web/src/components/general/Image.tsx | 25 ++----------------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/web/src/components/blocks/ContactEntityBlock.tsx b/web/src/components/blocks/ContactEntityBlock.tsx index abc4a27..224e906 100644 --- a/web/src/components/blocks/ContactEntityBlock.tsx +++ b/web/src/components/blocks/ContactEntityBlock.tsx @@ -43,6 +43,7 @@ export const ContactEntityBlock = ({ )} {image && ( diff --git a/web/src/components/general/Image.tsx b/web/src/components/general/Image.tsx index ac3e92b..1e60507 100644 --- a/web/src/components/general/Image.tsx +++ b/web/src/components/general/Image.tsx @@ -7,27 +7,6 @@ type ImageProps = NextImageProps & { imageFormat?: string | null; // "original" | "bleed" | "fullWidth" }; -function isSvgSrc(src: NextImageProps["src"]): src is string { - return typeof src === "string" && /\.svg(\?|#|$)/i.test(src); -} - -function MaybeNextImage(props: NextImageProps) { - if (isSvgSrc(props.src)) { - const { src, alt, width, height, className, style } = props; - return ( - {alt} - ); - } - return ; -} - export function ImageFigure(props: ImageProps) { const { attribution, caption, imageFormat, ...imageProps } = props; return ( @@ -35,7 +14,7 @@ export function ImageFigure(props: ImageProps) { className={`${styles.image} ${imageFormat ? styles[imageFormat] : ""}`} >
- + {attribution &&
{attribution}
}
{caption &&
{caption}
} @@ -44,5 +23,5 @@ export function ImageFigure(props: ImageProps) { } export function Image(props: NextImageProps) { - return ; + return ; }