From ad0156dbfe22fb1c6150f2ebef51ade808229fef Mon Sep 17 00:00:00 2001 From: Dylan Awalt-Conley Date: Wed, 19 Jun 2024 23:45:30 -0400 Subject: [PATCH] docs: fix astro solution --- solutions/astro.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/solutions/astro.md b/solutions/astro.md index 17a79eb..0c32e44 100644 --- a/solutions/astro.md +++ b/solutions/astro.md @@ -79,7 +79,7 @@ export interface Props extends HTMLAttributes<'picture'>, ImageOptions { src: string; alt: string; sizes: string - imgProps?: HTMLAttributes<'img'>; + imgProps?: Omit, 'sizes' | 'class:list'> } const { src, alt, sizes, widths, formats, imgProps, ...pictureProps } = @@ -96,9 +96,13 @@ const images = new ResponsiveImages({ disable: !import.meta.env.PROD, }); +const imgOptions: ImageOptions = {} +if (widths) imgOptions.widths = widths +if (formats) imgOptions.formats = formats + const sources = await images .responsive(src) - .fromSizes(sizes, { widths, formats }) + .fromSizes(sizes, imgOptions) .toSources({ ...imgProps, alt }) ---