HEX
Server: LiteSpeed
System: Linux server318.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: sahadove (2893)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: /home/sahadove/wp-content/plugins/extendify/src/Draft/components/stock-images/UnsplashImages.jsx
import { __ } from '@wordpress/i18n';
import { UnsplashImage } from '@draft/components/stock-images/UnsplashImage';

export const UnsplashImages = ({
	images,
	isInsertingImage,
	onClick,
	loading,
}) => {
	const imageLength = images?.length ?? 10;

	if (!loading && !images.length) {
		return __('No images found.', 'extendify-local');
	}

	return (
		<div className="columns-2 gap-1">
			{Array.from({ length: imageLength }).map((_, idx) => {
				const skeletonHeight = [150, 175, 200];
				return (
					<UnsplashImage
						key={images?.[idx]?.id ?? idx}
						image={images?.[idx]}
						skeletonHeight={skeletonHeight[idx % skeletonHeight.length]}
						isInsertingImage={isInsertingImage}
						onClick={onClick}
					/>
				);
			})}
		</div>
	);
};