diff --git a/src/components/blog/BlogImagePopup.jsx b/src/components/blog/BlogImagePopup.jsx index 9be9010..09dc078 100644 --- a/src/components/blog/BlogImagePopup.jsx +++ b/src/components/blog/BlogImagePopup.jsx @@ -1,8 +1,18 @@ -import React, { Fragment } from 'react'; +import React, { Fragment, Suspense } from 'react'; import { Dialog, Transition } from '@headlessui/react'; -import { TransformWrapper, TransformComponent } from 'react-zoom-pan-pinch'; import useImagePreview from '../../state/useImagePreview'; +const TransformWrapper = React.lazy(() => + import('react-zoom-pan-pinch').then((module) => ({ + default: module.TransformWrapper, + })) +); +const TransformComponent = React.lazy(() => + import('react-zoom-pan-pinch').then((module) => ({ + default: module.TransformComponent, + })) +); + export default function BlogImagePopup() { const { isOpen, close, clear, imgSrc, alt, width, height } = useImagePreview(); @@ -73,23 +83,25 @@ export default function BlogImagePopup() {
- - - {alt} - - + Loading...
}> + + + {alt} + + +