'use client' import React, { useState, useEffect } from 'react' import type { Page } from '../../payload-types' type Props = Extract[0], { blockType: 'testimonials' }> export const TestimonialsBlock: React.FC = ({ title, testimonials }) => { const [currentIndex, setCurrentIndex] = useState(0) useEffect(() => { if (!testimonials || testimonials.length <= 1) return const timer = setInterval(() => { setCurrentIndex((prev) => (prev + 1) % testimonials.length) }, 7000) return () => clearInterval(timer) }, [testimonials]) if (!testimonials || testimonials.length === 0) return null return (

// {title}

{testimonials.map((t: NonNullable[0], index: number) => (

"{t.quote}"

{t.author}

))}
{testimonials.length > 1 && (
{testimonials.map((_, index) => (
)}
) }