import { isValidElement } from 'react'; export type TestimonialsProps = { heading?: string; testimonials?: Array<{ quote: string; name: string; role: string; avatarUrl?: string }>; }; export default function Testimonials({ heading = '', testimonials = [] }: TestimonialsProps) { return (

{heading}

{testimonials.map((testimonial, index) => (
“{testimonial.quote}”
{testimonial.avatarUrl ? : } {testimonial.name}{testimonial.role}
))}
); } function getInitial(value: unknown): string { if (typeof value === 'string' || typeof value === 'number') { return String(value).trim().charAt(0).toUpperCase() || '•'; } if (Array.isArray(value)) { for (const child of value) { const initial = getInitial(child); if (initial !== '•') return initial; } } if (isValidElement<{ children?: unknown }>(value)) { return getInitial(value.props.children); } return '•'; }