| 1 |
import { UnsplashImage } from '@draft/components/stock-images/UnsplashImage'; |
| 2 |
import { __ } from '@wordpress/i18n'; |
| 3 |
|
| 4 |
export const UnsplashImages = ({ |
| 5 |
images, |
| 6 |
isInsertingImage, |
| 7 |
onClick, |
| 8 |
loading, |
| 9 |
}) => { |
| 10 |
const imageLength = images?.length ?? 10; |
| 11 |
|
| 12 |
if (!loading && !images.length) { |
| 13 |
return __('No images found.', 'extendify-local'); |
| 14 |
} |
| 15 |
|
| 16 |
return ( |
| 17 |
<div className="columns-2 gap-1"> |
| 18 |
{Array.from({ length: imageLength }).map((_, idx) => { |
| 19 |
const skeletonHeight = [150, 175, 200]; |
| 20 |
return ( |
| 21 |
<UnsplashImage |
| 22 |
key={images?.[idx]?.id ?? idx} |
| 23 |
image={images?.[idx]} |
| 24 |
skeletonHeight={skeletonHeight[idx % skeletonHeight.length]} |
| 25 |
isInsertingImage={isInsertingImage} |
| 26 |
onClick={onClick} |
| 27 |
/> |
| 28 |
); |
| 29 |
})} |
| 30 |
</div> |
| 31 |
); |
| 32 |
}; |
| 33 |
|