fix: type warnings in Picture component

This commit is contained in:
Stefan Imhoff
2023-12-15 14:58:04 +01:00
parent 59a3a859af
commit a88f5002a6

View File

@@ -1,10 +1,13 @@
---
import cx from 'classnames';
import { Picture } from 'astro-imagetools/components';
import { Picture as AstroImageToolsPicture } from 'astro-imagetools/components';
import type { PictureConfigOptions } from 'astro-imagetools';
interface Props extends PictureConfigOptions {
alt: string;
aspect: number;
breakpoints?: number[];
class?: string;
noMargin?: boolean;
src: string;
@@ -24,7 +27,12 @@ const classes = cx(
src.includes('.svg') ? (
<img src={src} {...(props as any)} />
) : (
<Picture breakpoints={[500, 1000, 1500]} format={['avif']} src={src} {...props} />
<AstroImageToolsPicture
breakpoints={[500, 1000, 1500]}
format={['avif']}
src={src}
{...props}
/>
)
}
</div>