From 33663af75e700709e72fbee58bbe85ccb982e0a3 Mon Sep 17 00:00:00 2001 From: Stefan Imhoff Date: Thu, 18 May 2023 16:52:05 +0200 Subject: [PATCH] fix: make sure the component doesn't crash with SVG images --- src/components/Picture.astro | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/Picture.astro b/src/components/Picture.astro index 8588e8a..cb7c7ba 100644 --- a/src/components/Picture.astro +++ b/src/components/Picture.astro @@ -7,9 +7,10 @@ import type { PictureConfigOptions } from 'astro-imagetools'; interface Props extends PictureConfigOptions { class?: string; noMargin?: boolean; + src: string; } -const { class: className, noMargin, ...props } = Astro.props; +const { class: className, noMargin, src, ...props } = Astro.props; const classes = cx( 'image-shadow block h-auto w-full rounded-1 border-1 border-solid border-black/[0.1] bg-black/[0.1] shadow shadow-black/10 mbe-10 mbs-0 dark:border-white/[0.1] dark:opacity-[0.87] dark:shadow-white/10', @@ -19,5 +20,11 @@ const classes = cx( ---
- + { + src.includes('.svg') ? ( + + ) : ( + + ) + }