import React, { forwardRef } from "react"; import { TestimonialSectionProps } from "../../types"; import { Card, CardContent } from "../ui/Card"; export const TestimonialSection = forwardRef< HTMLElement, TestimonialSectionProps >( ( { className = "", title = "What Our Customers Say", subtitle = "Don't just take our word for it - hear from our satisfied customers", testimonials = [ { content: "This component library saved us weeks of development time. The authentication system works flawlessly.", author: "Sarah Johnson", role: "Lead Developer", company: "TechCorp", rating: 5, }, { content: "The design is beautiful and the components are well-documented. Highly recommended!", author: "Mike Chen", role: "Frontend Engineer", company: "StartupXYZ", rating: 5, }, { content: "Excellent TypeScript support and great accessibility features. Perfect for our needs.", author: "Emma Davis", role: "UI/UX Designer", company: "DesignCo", rating: 5, }, ], variant = "cards", children, ...props }, ref ) => { const renderStars = (rating: number = 5) => { return Array.from({ length: 5 }, (_, i) => ( )); }; const renderTestimonial = ( testimonial: (typeof testimonials)[0], index: number ) => (
{renderStars(testimonial.rating)}
"{testimonial.content}"
{testimonial.avatar && ( {testimonial.author} )}
{testimonial.author}
{(testimonial.role || testimonial.company) && (
{testimonial.role} {testimonial.role && testimonial.company && " at "} {testimonial.company}
)}
); return (

{title}

{subtitle && (

{subtitle}

)}
{testimonials.map((testimonial, index) => renderTestimonial(testimonial, index) )}
{children}
); } ); TestimonialSection.displayName = "TestimonialSection";