'use client' import { useState, useEffect } from 'react' import Image from 'next/image' import styles from './Testimonials.module.css' import { testimonialData } from '@/utils/constant' const testimonials = testimonialData export default function Testimonials() { const [currentIndex, setCurrentIndex] = useState(0) const nextSlide = () => { setCurrentIndex((prev) => (prev + 1) % (testimonials.length - 2)) } const prevSlide = () => { setCurrentIndex((prev) => (prev === 0 ? testimonials.length - 3 : prev - 1)) } // Auto-slide effect useEffect(() => { const interval = setInterval(() => { nextSlide() }, 5000) // Change slide every 5 seconds return () => clearInterval(interval) }, []) // Get the 3 visible testimonials const getVisibleTestimonials = () => { const items = [] for (let i = 0; i < 3; i++) { const index = (currentIndex + i) % testimonials.length items.push(testimonials[index]) } return items } const visibleItems = getVisibleTestimonials() return (
Antalya Dinner Icon ANTALYA Antalya Cutlery Icon

Testimonials

{visibleItems.map((item) => (
{item.name}

— {item.name}

"{item.text}"

{'★★★★★'}
))}
Review Us on Google
) }