import React from "react"; import Image from "next/image"; import type { Product } from "../types"; export function ProductCard({ item, basePath = "" }: { item: Product; basePath?: string }) { const hasLink = Boolean(item.href); const summary = item.summary ?? item.description; const Wrapper = hasLink ? "a" : "div"; const wrapperProps = hasLink ? { href: `${basePath}${item.href}` } : {}; const content = (
{/* 第一行:图片 */}
{item.name}
{/* 第二行:文字内容 */}
{item.eyebrow && (
{item.eyebrow}
)}

{item.name}

{summary && (

{summary}

)} {item.bullets && item.bullets.length > 0 && ( )} {item.badges && item.badges.length > 0 && (
{item.badges.map((badge, index) => { const isPrimary = index === 0; return ( {badge} ); })}
)} {item.price != null && (
¥{item.price}
)}
); return ( )} className="group block focus:outline-none focus-visible:ring-2 focus-visible:ring-[#118af4]/60" > {content} ); }