diff --git a/src/app/home/components/Categories.tsx b/src/app/home/components/Categories.tsx index 6bd1233..4e6d1f4 100644 --- a/src/app/home/components/Categories.tsx +++ b/src/app/home/components/Categories.tsx @@ -11,10 +11,11 @@ const Categories = () => { const parentCategories = data?.results?.data?.filter(cat => !cat.parent) || [] return ( -
+
= ({ product }) => { } return ( -
+
e.stopPropagation()}>
+ +
+
+ {currentIndex + 1} / {images.length} +
+
+ + {/* Main Image */} +
+
{ + e.stopPropagation() + toggleZoom() + }} + onMouseMove={handleMouseMove} + > +
+ {`${productName} +
+
+ + {/* Navigation Buttons */} + {images.length > 1 && !isZoomed && ( + <> + + + + )} +
+ + {/* راهنما */} + {isZoomed && ( +
+ برای خروج از حالت زوم ESC یا دوباره کلیک کنید +
+ )} + + {/* Thumbnails */} +
e.stopPropagation()} + > + {images.map((image, index) => ( +
onIndexChange(index)} + > + {`${productName} +
+ ))} +
+
+ ) +} + +export default ImageGalleryModal diff --git a/src/app/product/components/ProductImage.tsx b/src/app/product/components/ProductImage.tsx index bc01494..be88f6f 100644 --- a/src/app/product/components/ProductImage.tsx +++ b/src/app/product/components/ProductImage.tsx @@ -4,6 +4,7 @@ import { FC, useState } from 'react' import ActionProduct from './ActionProduct' import { Product } from '@/types/product.types' import ModalReport from './ModalReport' +import ImageGalleryModal from './ImageGalleryModal' interface ProductImageProps { product: Product @@ -11,19 +12,23 @@ interface ProductImageProps { const ProductImage: FC = ({ product }) => { const [selectedImageIndex, setSelectedImageIndex] = useState(0) + const [isGalleryOpen, setIsGalleryOpen] = useState(false) const allImages = [product.imagesUrl.cover, ...product.imagesUrl.list] const selectedImage = allImages[selectedImageIndex] return (
-
+
setIsGalleryOpen(true)} + > {product.title_fa}
@@ -48,6 +53,15 @@ const ProductImage: FC = ({ product }) => { ))}
+ + setIsGalleryOpen(false)} + onIndexChange={setSelectedImageIndex} + />
) }