"use client";
import { motion } from "framer-motion";
type Review = {
name: string;
rating: string;
dateLabel: string;
quote: string;
};
type Props = {
reviews: Review[];
};
function StarRating({ rating }: { rating: string }) {
const score = parseFloat(rating);
const full = Math.floor(score);
return (
{Array.from({ length: 5 }).map((_, i) => (
★
))}
);
}
function ReviewCard({ review }: { review: Review }) {
return (
{review.dateLabel}
"{review.quote}"
);
}
export function TestimonialsCarousel({ reviews }: Props) {
// Triple the items for a seamless infinite loop at any scroll speed
const tripled = [...reviews, ...reviews, ...reviews];
return (
{tripled.map((review, i) => (
))}
{/* Edge fade overlays */}
);
}