"use client"; import { useState } from "react"; import { testimonials } from "@/data/site"; function QuoteIcon() { return ( ); } export default function Testimonials({ title }: { title?: string }) { const [index, setIndex] = useState(0); const visible = [0, 1, 2].map((offset) => { const item = testimonials[(index + offset) % testimonials.length]; return { item, key: `${index}-${offset}` }; }); return ( {title || "نظر برخی مراجعه کنندگان عزیز"} USER COMMENTS {visible.map(({ item, key }) => ( {item.text} {item.author} ))} {testimonials.map((_, i) => ( setIndex(i)} /> ))} ); }
USER COMMENTS
{item.text}