mirror of
https://github.com/kogakure/website-astro-stefanimhoff.de.git
synced 2026-02-03 20:15:27 +00:00
fix: make sure the component doesn't crash with SVG images
This commit is contained in:
@@ -7,9 +7,10 @@ import type { PictureConfigOptions } from 'astro-imagetools';
|
|||||||
interface Props extends PictureConfigOptions {
|
interface Props extends PictureConfigOptions {
|
||||||
class?: string;
|
class?: string;
|
||||||
noMargin?: boolean;
|
noMargin?: boolean;
|
||||||
|
src: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { class: className, noMargin, ...props } = Astro.props;
|
const { class: className, noMargin, src, ...props } = Astro.props;
|
||||||
|
|
||||||
const classes = cx(
|
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',
|
'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(
|
|||||||
---
|
---
|
||||||
|
|
||||||
<div class={classes}>
|
<div class={classes}>
|
||||||
<Picture {...props} />
|
{
|
||||||
|
src.includes('.svg') ? (
|
||||||
|
<img src={src} {...(props as any)} />
|
||||||
|
) : (
|
||||||
|
<Picture src={src} {...props} />
|
||||||
|
)
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user