"use client"; import React, { useState, useEffect, useCallback } from 'react'; interface Testimonial { id: number; name: string; role: string; company: string; content: string; avatar?: string; rating: number; } interface TestimonialSliderProps { testimonials: Testimonial[]; autoPlayInterval?: number; } export const TestimonialSlider: React.FC = ({ testimonials, autoPlayInterval = 5000 }) => { const [currentIndex, setCurrentIndex] = useState(0); const [isAnimating, setIsAnimating] = useState(false); const goToNext = useCallback(() => { if (isAnimating) return; setIsAnimating(true); setCurrentIndex((prev) => (prev + 1) % testimonials.length); setTimeout(() => setIsAnimating(false), 500); }, [isAnimating, testimonials.length]); const goToPrev = useCallback(() => { if (isAnimating) return; setIsAnimating(true); setCurrentIndex((prev) => (prev - 1 + testimonials.length) % testimonials.length); setTimeout(() => setIsAnimating(false), 500); }, [isAnimating, testimonials.length]); useEffect(() => { const interval = setInterval(goToNext, autoPlayInterval); return () => clearInterval(interval); }, [goToNext, autoPlayInterval]); const currentTestimonial = testimonials[currentIndex]; return (
{/* Background decoration */}
"
"
{/* Main card */}
{/* Content */}
{/* Stars */}
{[...Array(5)].map((_, i) => ( ))}
{/* Quote */}

"{currentTestimonial.content}"

{/* Author */}
{/* Avatar */}
{currentTestimonial.name.charAt(0)}
{/* Info */}
{currentTestimonial.name}
{currentTestimonial.role} • {currentTestimonial.company}
{/* Navigation */}
{/* Arrows */}
{/* Dots */}
{testimonials.map((_, index) => (
); };