30 lines
480 B
TypeScript
30 lines
480 B
TypeScript
import React from 'react';
|
|
import { Box, BoxProps } from './Box';
|
|
|
|
export interface ImageProps extends Omit<BoxProps<'img'>, 'children'> {
|
|
src: string;
|
|
alt: string;
|
|
fallbackSrc?: string;
|
|
}
|
|
|
|
/**
|
|
* Image
|
|
*
|
|
* Stateless UI primitive for images.
|
|
* For error handling, use SafeImage component.
|
|
*/
|
|
export const Image = ({
|
|
src,
|
|
alt,
|
|
...props
|
|
}: ImageProps) => {
|
|
return (
|
|
<Box
|
|
as="img"
|
|
src={src}
|
|
alt={alt}
|
|
{...props}
|
|
/>
|
|
);
|
|
};
|