review-05-block
stackzero/review-05-blockFreeBlock
stackzero publishes no description for this item.
Install it
npx shadcn@latest add https://ui.stackzero.co/r/review-05-block.jsonSource
1import StarRating from "@/components/commerce-ui/star-rating-fractions";2import { Progress } from "@/components/ui/progress";34interface ReviewStatProps {5 stars: number;6 percentage: number;7 count: number;8}910interface ReviewStatData {11 stars: number;12 percentage: number;13 count: number;14}1516interface Review_05Props {17 title?: string;18 subtitle?: string;19 overallRating?: number;20 totalReviewCount?: number;21 verifiedPurchases?: number;22 reviewStats?: ReviewStatData[];23 showProgress?: boolean;24}2526function ReviewStat({ count, percentage, stars }: ReviewStatProps) {27 return (28 <div className="flex w-full items-center gap-2">29 <div className="w-16 text-right text-sm">{stars} stars</div>30 <Progress value={percentage} className="h-2 flex-1" />31 <div className="text-muted-foreground w-12 text-left text-sm">32 {count}33 </div>34 </div>35 );36}3738function Review_05({39 overallRating = 4.7,40 reviewStats = [41 { count: 629, percentage: 76, stars: 5 },42 { count: 116, percentage: 14, stars: 4 },43 { count: 50, percentage: 6, stars: 3 },44 { count: 24, percentage: 3, stars: 2 },45 { count: 8, percentage: 1, stars: 1 },46 ],47 showProgress = true,48 subtitle = "What our customers are saying",49 title = "Customer Reviews",50 totalReviewCount = 827,51 verifiedPurchases = 756,52}: Review_05Props = {}) {53 const verifiedPercentage = Math.round(54 (verifiedPurchases / totalReviewCount) * 10055 );5657 return (58 <div className="flex flex-col gap-8 rounded-lg bg-white px-6 py-6 dark:bg-gray-950">59 <div className="flex flex-col items-center text-center">60 <h2 className="mb-1 text-2xl font-bold">{title}</h2>61 <p className="text-muted-foreground mb-6 text-sm">{subtitle}</p>6263 <div className="mb-4 flex flex-col items-center">64 <span className="mb-2 text-5xl font-bold">{overallRating}</span>65 <StarRating66 value={overallRating}67 readOnly68 iconSize={24}69 className="mb-2"70 />71 <p className="text-muted-foreground text-sm">72 Based on {totalReviewCount} reviews73 </p>74 </div>7576 <div className="mb-2 w-full max-w-xs rounded-md bg-gray-50 px-4 py-3 dark:bg-gray-900">77 <p className="text-sm">78 <span className="font-medium">{verifiedPercentage}%</span> of79 reviews from{" "}80 <span className="font-medium text-green-600 dark:text-green-400">81// … truncated
What it pulls in
Other registry items
Files it writes
More from stackzero
All 112 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| address-01-blockaddress-01-block | stackzero | Blocks | Free | 4 deps | |
| address-02-blockaddress-02-block | stackzero | Blocks | Free | 4 deps | |
| address-03-blockaddress-03-block | stackzero | Blocks | Free | 4 deps | |
| banner-01-blockbanner-01-block | stackzero | Blocks | Free | no deps | |
| banner-02-blockbanner-02-block | stackzero | Blocks | Free | no deps | |
| banner-03-blockbanner-03-block | stackzero | Blocks | Free | no deps | |
| banner-04-blockbanner-04-block | stackzero | Blocks | Free | no deps | |
| banner-05-blockbanner-05-block | stackzero | Blocks | Free | no deps |
