2022-07-01 10:47:48 -05:00
|
|
|
---
|
|
|
|
// @ts-ignore
|
2022-07-22 18:01:56 -05:00
|
|
|
import { getImage } from '../dist/index.js';
|
2022-09-01 16:24:07 -05:00
|
|
|
import { warnForMissingAlt } from './index.js';
|
2023-01-17 21:41:50 -05:00
|
|
|
import type { ImageComponentLocalImageProps, ImageComponentRemoteImageProps } from './index.js';
|
2022-07-01 10:47:48 -05:00
|
|
|
|
2023-01-17 21:41:50 -05:00
|
|
|
export type Props = ImageComponentLocalImageProps | ImageComponentRemoteImageProps;
|
2022-07-01 10:47:48 -05:00
|
|
|
|
2023-01-17 21:41:50 -05:00
|
|
|
const { loading = 'lazy', decoding = 'async', ...props } = Astro.props;
|
2022-07-01 10:47:48 -05:00
|
|
|
|
2022-09-01 16:24:07 -05:00
|
|
|
if (props.alt === undefined || props.alt === null) {
|
|
|
|
warnForMissingAlt();
|
|
|
|
}
|
|
|
|
|
2022-07-22 18:01:56 -05:00
|
|
|
const attrs = await getImage(props);
|
2022-07-08 16:37:55 -05:00
|
|
|
---
|
2022-07-01 10:47:48 -05:00
|
|
|
|
2022-07-08 16:37:55 -05:00
|
|
|
<img {...attrs} {loading} {decoding} />
|