diff --git a/src/components/home/BeforeAfterGallery.tsx b/src/components/home/BeforeAfterGallery.tsx index 1eadc11..5adcd19 100644 --- a/src/components/home/BeforeAfterGallery.tsx +++ b/src/components/home/BeforeAfterGallery.tsx @@ -125,6 +125,16 @@ function BeforeAfterSlider({ result }: { result: typeof results[0] }) { } export default function BeforeAfterGallery() { + const [selectedIndex, setSelectedIndex] = useState(0); + + const goToPrev = () => { + setSelectedIndex(prev => prev === 0 ? results.length - 1 : prev - 1); + }; + + const goToNext = () => { + setSelectedIndex(prev => prev === results.length - 1 ? 0 : prev + 1); + }; + return (
@@ -143,8 +153,8 @@ export default function BeforeAfterGallery() { - {/* Two transformations side by side */} -
+ {/* Desktop: Two transformations side by side */} +
{results.map((result, index) => ( + {/* Mobile: Carousel with one transformation at a time */} +
+
+ + + +
+ + {/* Carousel Navigation */} + + + + + {/* Dot Indicators */} +
+ {results.map((_, index) => ( +
+
+ {/* CTA */} {/* Image Container */} -
+
{image ? ( - {localized.name} ) : ( diff --git a/src/components/product/ProductDetail.tsx b/src/components/product/ProductDetail.tsx index 1085db5..f5eeba3 100644 --- a/src/components/product/ProductDetail.tsx +++ b/src/components/product/ProductDetail.tsx @@ -152,7 +152,7 @@ export default function ProductDetail({ product, relatedProducts, locale = "SR" initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ duration: 0.6 }} - className="flex gap-4" + className="flex flex-col md:flex-row gap-4" > {/* Thumbnails - Vertical on Desktop, Hidden on Mobile */} {images.length > 1 && ( @@ -167,29 +167,64 @@ export default function ProductDetail({ product, relatedProducts, locale = "SR" : "border-transparent hover:border-[#999999]" }`} > - {image.alt ))}
)} -{/* Main Image */} -
- {images[selectedImage] && ( - {images[selectedImage].alt + {/* Main Image */} +
+ {images[selectedImage].alt + + {/* Carousel Navigation - Mobile Only */} + {images.length > 1 && ( + <> + {/* Left Arrow */} + + + {/* Right Arrow */} + + + {/* Dot Indicators - Mobile Only */} +
+ {images.map((_, index) => ( +
+ )}