// Gallery.jsx — Results grid + Before/After slider + Differentials let ALL_ITEMS = []; const FILTERS = ["Todos", "Design Natural", "Henna e Tintura", "Brow Lamination", "Lash Lifting"]; // Fetch dynamic data if available fetch('api.php') .then(res => res.json()) .then(data => { const results = [ ...(data.design || []), ...(data.brow || []), ...(data.henna || []) ]; const lash = data.lash || []; ALL_ITEMS = [...results, ...lash]; }) .catch(err => { console.log("Using fallback static data."); const RESULTS = [ { src: "https://imagedelivery.net/mYdfeAeRRdkIXG5w7XJhtQ/724fce1a-bbec-4f69-6dcd-324211594d00/public", label: "Design Natural" }, { src: "https://imagedelivery.net/mYdfeAeRRdkIXG5w7XJhtQ/e6091403-28a5-4e71-8834-5841bf3b6600/public", label: "Brow Lamination", span: true }, { src: "https://imagedelivery.net/mYdfeAeRRdkIXG5w7XJhtQ/1738ec87-9e58-4aff-be33-1fead70eef00/public", label: "Henna" } ]; ALL_ITEMS = RESULTS; }); /* ── Before/After Slider ─────────────────────────── */ function BeforeAfter({ before, after }) { const [pos, setPos] = React.useState(50); const containerRef = React.useRef(null); const dragging = React.useRef(false); const updatePos = React.useCallback((clientX) => { const rect = containerRef.current.getBoundingClientRect(); const x = Math.max(0, Math.min(1, (clientX - rect.left) / rect.width)); setPos(x * 100); }, []); const onMouseDown = (e) => { dragging.current = true; updatePos(e.clientX); }; const onMouseMove = (e) => { if (dragging.current) updatePos(e.clientX); }; const onMouseUp = () => { dragging.current = false; }; const onTouchStart = (e) => { dragging.current = true; updatePos(e.touches[0].clientX); }; const onTouchMove = (e) => { if (dragging.current) updatePos(e.touches[0].clientX); }; const onTouchEnd = () => { dragging.current = false; }; React.useEffect(() => { window.addEventListener("mouseup", onMouseUp); window.addEventListener("mousemove", onMouseMove); window.addEventListener("touchend", onTouchEnd); window.addEventListener("touchmove", onTouchMove, { passive: true }); return () => { window.removeEventListener("mouseup", onMouseUp); window.removeEventListener("mousemove", onMouseMove); window.removeEventListener("touchend", onTouchEnd); window.removeEventListener("touchmove", onTouchMove); }; }, []); return (
Arraste para ver a diferença que um design preciso faz.