diff --git a/src/components/home/BeforeAfterGallery.tsx b/src/components/home/BeforeAfterGallery.tsx index d8ce9bf..babf390 100644 --- a/src/components/home/BeforeAfterGallery.tsx +++ b/src/components/home/BeforeAfterGallery.tsx @@ -1,67 +1,43 @@ "use client"; import { motion } from "framer-motion"; -import { useState } from "react"; +import { useState, useRef } from "react"; const results = [ { id: 1, name: "Facial Skin Transformation", - beforeImg: "https://images.unsplash.com/photo-1559351283-d7fd36c8a4c0?w=600&h=750&fit=crop&q=80", - afterImg: "https://images.unsplash.com/photo-1616394584738-fc6e612e71b9?w=600&h=750&fit=crop&q=80", - description: "After 6 weeks with Manoon Anti-age Serum", + beforeImg: "https://images.unsplash.com/photo-1559351283-d7fd36c8a4c0?w=600&h=600&fit=crop&q=80", + afterImg: "https://images.unsplash.com/photo-1616394584738-fc6e612e71b9?w=600&h=600&fit=crop&q=80", + timeline: "4-6 Weeks", rating: 5, - reviewCount: 847, - }, - { - id: 2, - name: "Skin Radiance Journey", - beforeImg: "https://images.unsplash.com/photo-1594824476967-48c8b964273f?w=600&h=750&fit=crop&q=80", - afterImg: "https://images.unsplash.com/photo-1618944847829-3c1a3d1b7b7c?w=600&h=750&fit=crop&q=80", - description: "After 8 weeks with Manoon Morning Glow", - rating: 5, - reviewCount: 623, - }, - { - id: 3, - name: "Overall Skin Health", - beforeImg: "https://images.unsplash.com/photo-1552693673-1bf958298b77?w=600&h=750&fit=crop&q=80", - afterImg: "https://images.unsplash.com/photo-1596755389378-c31d21fd1273?w=600&h=750&fit=crop&q=80", - description: "After 4 weeks with Manoon Hair Elixir", - rating: 5, - reviewCount: 412, + reviewCount: 2847, }, ]; -function StarRating({ rating, count }: { rating: number; count: number }) { - return ( -
-
- {[1, 2, 3, 4, 5].map((star) => ( - - - - ))} -
- ({count} reviews) -
- ); -} - export default function BeforeAfterGallery() { - const [activeIndex, setActiveIndex] = useState(0); - const [showBefore, setShowBefore] = useState(false); - const activeResult = results[activeIndex]; + const [sliderPosition, setSliderPosition] = useState(50); + const containerRef = useRef(null); + + const handleMouseMove = (e: React.MouseEvent) => { + if (!containerRef.current) return; + const rect = containerRef.current.getBoundingClientRect(); + const x = ((e.clientX - rect.left) / rect.width) * 100; + setSliderPosition(Math.max(0, Math.min(100, x))); + }; + + const handleTouchMove = (e: React.TouchEvent) => { + if (!containerRef.current) return; + const rect = containerRef.current.getBoundingClientRect(); + const x = ((e.touches[0].clientX - rect.left) / rect.width) * 100; + setSliderPosition(Math.max(0, Math.min(100, x))); + }; return (
See the Transformation -

- Real customers, real results. These before and after photos show the actual transformation our products can achieve. -

-
- {/* Before/After Image */} +
+ {/* Before/After Slider */} - {/* Image Container */} -
- {showBefore - - {/* Gradient overlay */} -
- - {/* Before/After Label */} -
-
- {showBefore ? "BEFORE" : "AFTER"} -
-
+ {/* After Image (full width, underneath) */} + After - Smooth skin - {/* Results badge */} - {!showBefore && ( -
-
- - - - Verified Result -
-
- )} + {/* Before Image (clipped) */} +
+ Before - Wrinkled skin
- {/* Before/After Toggle */} -
-
- - + {/* Slider Handle */} +
+ {/* Handle Circle */} +
+ + +
+ + {/* Before Label */} +
+ BEFORE +
+ + {/* After Label */} +
+ AFTER +
- {/* Info Panel */} + {/* Timeline and Rating */} - {/* Thumbnails */} -
- {results.map((result, index) => ( - - ))} +
+ + + + {results[0].timeline}
- {/* Result Info */} -

- {activeResult.name} -

-

- {activeResult.description} -

-
- +
+
+ {[1, 2, 3, 4, 5].map((star) => ( + + + + ))} +
+ ({results[0].reviewCount.toLocaleString()} reviews)
+ - {/* Benefits */} -
- {[ - "Visible improvement in skin texture", - "Reduced appearance of fine lines", - "Improved skin hydration and radiance", - ].map((benefit, index) => ( -
-
- - - -
- {benefit} -
- ))} -
+ {/* Verified Results Badge */} + + + + + Verified Results + - {/* CTA */} - + {/* CTA */} + + + Start Your Transformation +