import type { Testimonial } from "@/lib/types";

/** Reuses the existing Testimonials collection (already real, admin-editable content —
 *  see the Website module) rather than a second, disconnected set of hardcoded reviews. */
export default function CustomerReviews({ testimonials }: { testimonials: Testimonial[] }) {
  if (testimonials.length === 0) return null;

  return (
    <section className="py-12">
      <h2 className="font-display text-2xl text-neutral-900 text-center">Customer Reviews</h2>
      <div className="mt-8 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
        {testimonials.map((r, i) => (
          <div key={i} className="rounded-xl2 border border-neutral-200 bg-neutral-100 p-6">
            <p className="text-accent-500" aria-hidden>
              {"★".repeat(r.rating)}
              {"☆".repeat(5 - r.rating)}
            </p>
            <p className="mt-3 text-sm text-neutral-600">{r.quote}</p>
            <p className="mt-4 text-sm font-medium text-neutral-900">{r.authorName}</p>
          </div>
        ))}
      </div>
    </section>
  );
}
