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