mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
006405d33c
* correct props type * refactor Picture and Image typings * add missing `alt` property * add changeset * apply suggestions * correct `astro/types` import Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com> * apply suggestions * convert to type import Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
18 lines
527 B
Text
18 lines
527 B
Text
---
|
|
// @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} />
|