import React, { useState, useEffect, useRef } from "react"; // Soluciones que iluminan — Storytelling visual (sin palabras) // Componente React de página única que presenta una historia solo con imágenes. // Instrucciones: // 1) Reemplaza las URLs en la constante `IMAGES` por tus imágenes (pueden ser rutas locales o URLs). // 2) Cada imagen representa una 'pantalla' de la historia. No hay texto visible. // 3) Para accesibilidad, cada imagen tiene alt="" por defecto (sin texto visible). Si quieres mejorar accesibilidad, // coloca descripciones en los atributos alt (no se mostrarán visualmente). // 4) Usa Tailwind CSS en tu proyecto o adapta las clases por tu propio CSS. const IMAGES = [ // sustituye estas URLs por tus imágenes reales "/images/hero-1.jpg", "/images/hero-2.jpg", "/images/hero-3.jpg", "/images/hero-4.jpg", "/images/hero-5.jpg", ]; export default function SolucionesQueIluminanStory() { const [index, setIndex] = useState(0); const timeoutRef = useRef(null); // auto-advance every 6s (configurable) useEffect(() => { resetTimeout(); timeoutRef.current = setTimeout(() => { setIndex((prev) => (prev + 1) % IMAGES.length); }, 6000); return () => { resetTimeout(); }; }, [index]); function resetTimeout() { if (timeoutRef.current) { clearTimeout(timeoutRef.current); } } // swipe handlers for touch devices const touchStartX = useRef(null); const touchEndX = useRef(null); function handleTouchStart(e) { touchStartX.current = e.touches[0].clientX; } function handleTouchMove(e) { touchEndX.current = e.touches[0].clientX; } function handleTouchEnd() { if (touchStartX.current == null || touchEndX.current == null) return; const diff = touchStartX.current - touchEndX.current; const threshold = 50; // swipe threshold in px if (diff > threshold) { // swipe left -> next setIndex((i) => (i + 1) % IMAGES.length); } else if (diff < -threshold) { // swipe right -> prev setIndex((i) => (i - 1 + IMAGES.length) % IMAGES.length); } touchStartX.current = null; touchEndX.current = null; } // keyboard navigation useEffect(() => { function onKey(e) { if (e.key === "ArrowRight") setIndex((i) => (i + 1) % IMAGES.length); if (e.key === "ArrowLeft") setIndex((i) => (i - 1 + IMAGES.length) % IMAGES.length); } window.addEventListener("keydown", onKey); return () => window.removeEventListener("keydown", onKey); }, []); return (
{/* Fullscreen container */}
{/* Image slides (absolute stacked) */} {IMAGES.map((src, i) => (
e.preventDefault()} /> {/* Decorative gradient to make transitions feel cinematic - no text */}
))} {/* Small visual pager: dots only (no text) */} {/* Invisible left/right click areas for desktop navigation */}
{/* Optional: progress bar (subtle) */}
); }