sendou.ink/app/components/Image.tsx
2022-07-05 11:30:01 +03:00

39 lines
642 B
TypeScript

export function Image({
path,
alt,
title,
className,
width,
height,
style,
}: {
path: string;
alt: string;
title?: string;
className?: string;
width?: number;
height?: number;
style?: React.CSSProperties;
}) {
return (
<picture title={title}>
<source
type="image/avif"
srcSet={`${path}.avif`}
className={className}
width={width}
height={height}
style={style}
/>
<img
alt={alt}
src={`${path}.png`}
className={className}
width={width}
height={height}
style={style}
/>
</picture>
);
}