---
// for a /public image path, upgraded to with AVIF/WebP srcsets when
// scripts/optimize-images.mjs has variants for it. The original stays as the fallback.
// `sizes` should describe the rendered width so phones fetch a phone-sized file.
import type { HTMLAttributes } from "astro/types";
import { imageVariants } from "@utils/images.mjs";
type Props = Omit, "src" | "srcset" | "sizes"> & {
src: string;
sizes?: string;
};
const { src, sizes = "100vw", width, height, ...attrs } = Astro.props;
const variants = imageVariants(src);
---
{
variants ? (
) : (
)
}