1
0
mirror of https://github.com/tabler/tabler.git synced 2026-08-16 08:12:22 +04:00
Files
tabler/site/components/ResponsiveImage.tsx
T
2023-07-18 00:13:56 +02:00

33 lines
647 B
TypeScript

import clsx from 'clsx';
import Image from 'next/image';
export default function ResponsiveImage(props) {
if (props.url) {
return (
<img
src={props.url}
className={clsx('img-fluid', props.className)}
width={props.width}
height={props.height}
loading="lazy"
alt={props.alt || ''}
/>
);
}
const src2x = props.src;
return (
<Image
className={clsx(props.className)}
src={src2x}
alt={props.alt || ''}
width={props.width}
height={props.height}
quality={85}
srcSet={[props.width, props.width * 2]}
{...props}
/>
);
}