Files
roblox/components/lazyLoadedImage.tsx
2025-02-14 19:43:05 +02:00

24 lines
500 B
TypeScript

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