This commit is contained in:
2026-02-05 17:22:56 +07:00
parent a499e06b31
commit 52748cb988
30 changed files with 1080 additions and 508 deletions

View File

@@ -8,15 +8,18 @@ import CommentList from "./CommentList";
export default function Comment() {
const [star, setStar] = useState<number | null>(null);
const productComment = CommentData.list.filter( (item:any) => item.item_type === "product" );
const filteredComments = useMemo(() => {
if (star === null) return CommentData.list;
return CommentData.list.filter(item => Number(item.rate) === star);
if (star === null) return productComment;
return productComment.filter(item => Number(item.rate) === star);
}, [star]);
return (
<div>
<div className="flex items-center justify-between leading-8 gap-2 mb-4">
<p className="m-0 text-18 font-500"> {CommentData.list.length} Bình luận </p>
<p className="m-0 text-18 font-500"> {filteredComments.length} Bình luận </p>
<div className="flex flex-wrap gap-2 text-14 font-500 pd-comment-btn">
<button type="button"