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"

View File

@@ -4,7 +4,6 @@ import { useState } from 'react'
import dynamic from 'next/dynamic'
import { Swiper, SwiperSlide } from 'swiper/react'
import { Navigation } from 'swiper/modules'
import Link from 'next/link'
const PhotoSwipeImage = dynamic(
() => import('./PhotoSwipeImage'),

View File

@@ -1,5 +1,6 @@
import parse from 'html-react-parser';
import { formatPrice } from "@/lib/utils";
import ProductImage from "./images";
import Static from "./static";
import ProductDescription from "./description"

View File

@@ -2,7 +2,7 @@
import { useEffect, useState, useMemo } from "react";
import { Swiper, SwiperSlide } from 'swiper/react';
import { Navigation, Pagination, Autoplay } from 'swiper/modules';
import { ProductHistory } from "@/data/productHistory";
import { ProductHistory } from "@/data/products/productHistory";
import ProductItem from "@/components/shared/ProductItem"
export default function ProductTab({ item }: any) {

View File

@@ -7,6 +7,7 @@ import ReviewList from "./ReviewList";
export default function Review( {item} : any ) {
const [ show, setShow ] = useState(false);
const productReview = item.list.filter( (item:any) => item.item_type === "product" );
return (
<>
@@ -34,9 +35,9 @@ export default function Review( {item} : any ) {
<ReviewForm />
</div>
{item.list.length > 0 &&
{productReview.length > 0 &&
<div className="text-14 leading-[18px] mt-4">
<ReviewList item={item.list}/>
<ReviewList item={productReview}/>
</div>
}
</div>