Files
novalon-website/src/components/detail/product-card.tsx
T
zhangxiang 8c64064181 refactor(detail): 共享详情件残余清账(P4-B4)
范围:solution-service-card / l3-signals-slot / product-card / solution-value /
detail-case-study / detail-product-value / detail-trust-section 七个共享件 +
products hub 的两处遗留图标砖。这些件被 product·solution·service·case 详情页共用,
所以一批改完等于把残余存量从"散落在模板里"收敛到"两处已裁定的豁免"。

棘轮读数
- R13 40→**19**:rounded-2xl/xl/lg/md 21 处 → 直角;小圆点(1–1.5px)直接去圆
- R14 12→7:hover:-translate-y 5 处
- R15 12→7:shadow-md 装饰投影 5 处
- R17 22→**13**:font-black 9 处 → font-bold

残余 19(R13)/13(R17)**有意保留**,两条都是已裁定的边界:
- `about/brand`(5+11):DESIGN 明写的**遗产豁免**页(90vh / 楷体),随页面退役一并处理;
- `products/standalone/[id]`(8+0):seed 无数据 ⇒ 该路由 404、不可观测,
  改了也没有任何验证手段,不制造"改过了"的假象。

验证
- check:grammar --selftest 通过;check:grammar 19/19 EXIT=0
- check:accents / check:a11y / check:motion 全 EXIT=0
- type-check EXIT=0;eslint 0 error;jest 157 套件 / 1849 例全通过
- 视觉:只读复跑 /products/erp-upgrade-v3 在 5 个 project 一致判红(真变化:该页直接
  使用 detail-product-value / detail-trust-section / l3-signals-slot),重采这 5 张后
  L1 全页组 80/80、全量 130/130 通过

P4 四批(hub 6 / 详情 5 / 信任 4 / 共享件 8)完成后的总账:
R13 71→19 · R14 21→7 · R15 20→7 · R16 26→8 · R17 53→13 · R19 21→0(硬禁)。
2026-11-03 19:16:16 +08:00

88 lines
2.9 KiB
TypeScript

'use client';
import { motion } from 'framer-motion';
import Link from 'next/link';
import Image from 'next/image';
import { ArrowRight, CheckCircle2 } from 'lucide-react';
interface ProductCardProps {
product: {
id: string;
title: string;
description: string;
image: string;
category: string;
status: string;
features?: string[];
};
}
export function ProductCard({ product }: ProductCardProps) {
return (
<motion.div
initial={{ opacity: 0, y: 30 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{
duration: 0.28,
ease: [0.22, 1, 0.36, 1] as const,
}}
className="group"
>
<Link href={`/products/${product.id}`} className="block">
<div className="relative h-full bg-bg-elevated border border-border-primary overflow-hidden hover:border-brand/30 transition-all duration-normal">
<div className="aspect-video relative overflow-hidden bg-bg-secondary">
<Image
src={product.image}
alt={product.title}
fill
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"
className="object-cover group-hover:scale-105 transition-transform duration-150"
/>
<div className="absolute top-4 left-4 flex gap-2">
<span className="px-3 py-1 rounded-cta text-xs font-semibold bg-brand text-white ">
{product.category}
</span>
{product.status === '已发布' && (
<span className="px-3 py-1 rounded-cta text-xs font-medium bg-green-500 text-white flex items-center gap-1">
<CheckCircle2 className="w-3 h-3" />
已发布
</span>
)}
</div>
</div>
<div className="p-6">
<h3 className="text-xl font-bold text-ink mb-3 group-hover:text-brand-ink transition-colors">
{product.title}
</h3>
<p className="text-sm text-text-muted leading-relaxed mb-5 line-clamp-2">
{product.description}
</p>
{product.features && product.features.length > 0 && (
<div className="flex flex-wrap gap-2 mb-5">
{product.features.slice(0, 3).map((feature) => (
<span
key={feature}
className="px-2.5 py-1 text-xs font-medium bg-bg-secondary text-text-muted border border-border-primary"
>
{feature}
</span>
))}
</div>
)}
<div className="flex items-center gap-2 text-sm font-semibold text-brand-ink group-hover:gap-3 transition-all">
了解详情
<ArrowRight className="w-4 h-4" />
</div>
</div>
</div>
</Link>
</motion.div>
);
}