16 lines
347 B
Plaintext
16 lines
347 B
Plaintext
---
|
|
import { Picture } from "@astrojs/image/components";
|
|
|
|
const { src, alt, width, height, ...attrs } = Astro.props;
|
|
---
|
|
|
|
<Picture
|
|
src={src}
|
|
widths={[320, 640, 768, attrs.width]}
|
|
aspectRatio={`${width}:${height}`}
|
|
sizes={`(max-width: ${attrs.width}px) 100vw, ${attrs.width}px`}
|
|
formats={["avif", "webp"]}
|
|
alt={alt ? alt : ""}
|
|
{...attrs}
|
|
/>
|