Files
roblox/components/lazyLoadedImage.tsx
2025-07-23 23:34:43 +03:00

29 lines
563 B
TypeScript

import React from 'react';
import { useThumbnailURL } from '@/hooks/use-lazy-load';
import { Skeleton } from './ui/skeleton';
interface LazyLoadedImageProps {
imgId: string;
alt: string;
[prop: string]: string
}
const LazyLoadedImage: React.FC<React.ImgHTMLAttributes<HTMLImageElement> & LazyLoadedImageProps> = ({
imgId,
alt,
...props
}) => {
const imgUrl = useThumbnailURL(imgId);
return (
<div>
{imgUrl ? (
<img src={imgUrl} alt={alt} {...props} />
) : (
<Skeleton {...props} />
)}
</div>
);
};
export default LazyLoadedImage;