import React, { useState, useEffect } from 'react'; import { motion, AnimatePresence, useReducedMotion } from 'framer-motion'; import { Quote } from 'lucide-react'; import { TESTIMONIALS } from '../../data/mockData'; import { Testimonial } from '../../types'; // Configuration for easy background changes const TESTIMONIAL_CONFIG = { // Warm, organic paper/spice trade texture backgroundUrl: 'https://messages-prod.27c852f3500f38c1e7786e2c9ff9e48f.r2.cloudflarestorage.com/127f0354-529e-41ed-a86e-e7c5b38fbada/1766075272000-019b3249-c833-740b-bff4-a0e2982db038.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=af634fe044bd071ab4c5d356fdace60f%2F20251218%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20251218T162752Z&X-Amz-Expires=3600&X-Amz-Signature=f98953947e1bb2f7bfacf717595c44c0038c0621612397413babb83817ca3edb&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject', autoAdvanceInterval: 7000, }; const TestimonialsSection: React.FC = () => { const [activeIndex, setActiveIndex] = useState(0); const [direction, setDirection] = useState<1 | -1>(1); const prefersReducedMotion = useReducedMotion(); // Auto-advance useEffect(() => { const timer = setInterval(() => { setDirection(1); setActiveIndex((prev) => (prev + 1) % TESTIMONIALS.length); }, TESTIMONIAL_CONFIG.autoAdvanceInterval); return () => clearInterval(timer); }, []); const activeTestimonial = TESTIMONIALS[activeIndex]; // Helper to determine font family and size adjustment based on language const getLanguageStyles = (lang: string) => { switch(lang) { case 'mr': // Marathi case 'hi': // Hindi return 'font-devanagari text-4xl md:text-5xl leading-snug'; case 'kn': // Kannada return 'font-kannada text-3xl md:text-5xl leading-loose py-2'; case 'en': // English default: return 'font-serif text-3xl md:text-4xl leading-tight italic'; } }; const slideVariants = { enter: (dir: 1 | -1) => ({ opacity: 0, y: prefersReducedMotion ? 0 : 24, x: prefersReducedMotion ? 0 : dir * 18, scale: prefersReducedMotion ? 1 : 0.985, }), center: { opacity: 1, y: 0, x: 0, scale: 1, }, exit: (dir: 1 | -1) => ({ opacity: 0, y: prefersReducedMotion ? 0 : -18, x: prefersReducedMotion ? 0 : dir * -18, scale: prefersReducedMotion ? 1 : 0.99, }), }; return (
{/* Textured Background - Changable via config */}
{/* Gentle Vignette */}
{/* Header - Subtle & Grounded */}
Voices of the Trade
{/* Quote Icon */}
{/* The Quote - Dynamic Font Family based on Language */}

"{activeTestimonial.quote}"

{/* Author Block */} {activeTestimonial.image && (
{activeTestimonial.name}
)}
{activeTestimonial.name}
{activeTestimonial.role} • {activeTestimonial.location}
{/* Navigation Dots */}
{TESTIMONIALS.map((_, index) => ( { setDirection(index > activeIndex ? 1 : -1); setActiveIndex(index); }} animate={ index === activeIndex ? { width: 32, height: 6, opacity: 1 } : { width: 6, height: 6, opacity: 0.65 } } transition={{ duration: 0.45, ease: [0.16, 1, 0.3, 1] }} className={`rounded-full transition-colors duration-300 ${ index === activeIndex ? 'bg-brand-maroon' : 'bg-brand-maroon/20 hover:bg-brand-maroon/40' }`} aria-label={`Go to testimonial ${index + 1}`} /> ))}
); }; export default TestimonialsSection;