summaryrefslogtreecommitdiff
path: root/packages/integrations/image/components/Image.astro
blob: dea492de0d169ed3a016eb22d07b01187c7d9e68 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
---
// @ts-ignore
import { getImage } from '../dist/index.js';
import { warnForMissingAlt } from './index.js';
import type { ImageComponentLocalImageProps, ImageComponentRemoteImageProps } from './index.js';

export type Props = ImageComponentLocalImageProps | ImageComponentRemoteImageProps;

const { loading = 'lazy', decoding = 'async', ...props } = Astro.props;

if (props.alt === undefined || props.alt === null) {
	warnForMissingAlt();
}

const attrs = await getImage(props);
---

<img {...attrs} {loading} {decoding} />