{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "review", "type": "registry:block", "title": "Review", "description": "Displays a review with headline, rating, comments, author info, and interactive voting functionality", "dependencies": [ "react", "@registry/react" ], "registryDependencies": [ "https://components.thgaltitude.com/r/react/ratings", "https://components.thgaltitude.com/r/react/button" ], "files": [ { "path": "registry/react/block/review.tsx", "content": "import React from \"react\";\nimport Ratings from \"@registry/react/ui/ratings\";\nimport { Button } from \"@registry/react/ui/button\";\n\nexport enum VoteType {\n UPVOTE = \"UPVOTE\",\n DOWNVOTE = \"DOWNVOTE\",\n REPORT = \"REPORT\",\n}\n\ninterface ReviewProps {\n headline: string;\n rating: number;\n comments: string;\n maxRating?: number;\n date?: string;\n author?: string;\n onVote?: (voteType: VoteType) => void;\n upVoteCount?: number;\n downVoteCount?: number;\n}\n\nexport const Review: React.FC = ({\n headline,\n rating,\n maxRating = 5,\n comments,\n date,\n author,\n onVote,\n upVoteCount,\n downVoteCount,\n}) => {\n return (\n
\n

{headline}

\n {rating && maxRating && (\n \n )}\n

{comments}

\n {(date || author) && (\n
\n {date}\n by {author}\n
\n )}\n {onVote && (\n
\n

Was this review helpful?

\n
\n onVote(VoteType.UPVOTE)}\n >\n Yes {typeof upVoteCount === \"number\" ? `(${upVoteCount})` : ``}\n \n onVote(VoteType.DOWNVOTE)}\n >\n No {typeof downVoteCount === \"number\" ? `(${downVoteCount})` : ``}\n \n onVote(VoteType.REPORT)}\n >\n Report this review\n \n
\n
\n )}\n
\n );\n};\n\nexport default Review;\n", "type": "registry:block", "target": "react/block/review.tsx" } ] }