import { OpenAddToCartModalButton } from "@/components/common/AddToCartModal/OpenAddToCartModalButton"; import Link from "next/link"; import Image from "next/image"; import type {HomeProduct,HomeSection} from "@/types/home/type" interface newArrivalSectionProps{ newArrivalSection:HomeSection |undefined; } const HomeNewArrival = ({ newArrivalSection }: newArrivalSectionProps) => { const newArrival: HomeProduct[] = newArrivalSection?.products ?? []; if (!newArrival || newArrival.length === 0) return null; // 4. 真实数据按每6个拆分一组,替换原来的模拟拆分逻辑 const chunkSize = 6; const productBlocks: HomeProduct[][] = []; for (let i = 0; i < newArrival.length; i += chunkSize) { productBlocks.push(newArrival.slice(i, i + chunkSize)); } return (
{/* 标题 */}

{newArrivalSection?.title}

{newArrival.map((product) => (
{product.name} {product.name}
{[1, 2, 3, 4, 5].map((star) => ( ))}
{product.review_count}
${product.min_price} ${product.price}
} />
))}
View More
); }; export default HomeNewArrival;