"use client"; import { useState, useEffect } from "react"; import styles from "@/app/channels/[slug]/channel-page.module.css"; import SafeImage from "./SafeImage"; import { Star, Quote } from "lucide-react"; interface Testimonial { quote: string; author: string; role: string; rating: number; image: string; } export default function ChannelTestimonialSlider({ testimonials }: { testimonials: Testimonial[] }) { const [currentIndex, setCurrentIndex] = useState(0); const [isAnimating, setIsAnimating] = useState(false); useEffect(() => { const interval = setInterval(() => { handleNext(); }, 5000); // 5 seconds per slide return () => clearInterval(interval); }, [testimonials.length]); const handleNext = () => { setIsAnimating(true); setTimeout(() => { setCurrentIndex((prev) => (prev + 1) % testimonials.length); setIsAnimating(false); }, 300); }; const current = testimonials[currentIndex]; return (
"{current.quote}"