Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 3x 6x 6x 3x | import React from "react"; import { IReview } from "@/interfaces"; export const Review = ({ review }: { review: IReview }) => { const [isExpanded, setIsExpanded] = React.useState<boolean>(false); return ( <div className="shadow-md border rounded-xl p-4"> <div className="flex items-center gap-2"> <div className="flex items-center justify-center text-white text-xl rounded-full bg-indigo-500 w-[32px] h-[32px]"> {review.author.slice(0, 1)} </div> <span className="font-bold text-sm md:text-xl"> A review by {review.author} </span> </div> <div className="mt-2 text-sm md:text-md"> {isExpanded ? ( <span>{review.content}</span> ) : ( <span>{review.content.substring(0, 550)}</span> )} <span className="underline cursor-pointer" onClick={() => setIsExpanded(!isExpanded)} > {isExpanded ? " Read Less" : "...Read More"} </span> </div> </div> ); }; |