--- import { markdownToHtml } from "@/lib/markdown"; import StarRating from "./subcomponents/StarRating.astro"; interface Props { reviews: ReviewListComponent; } const reviews = Astro.props.reviews; let totalStars: number = 0; const totalReviews: number = reviews.reviews.length; reviews.reviews.forEach((review) => { totalStars = totalStars + review.stars; }); const averageStars = Math.round((totalStars / totalReviews) * 10) / 10; const reviewsToShow = reviews.reviews.slice(0, 5); ---
{averageStars} stars out of {totalReviews} {totalReviews === 1 ? "review" : "reviews"}.