From dcc2073e1eeb40396d6a4484abbaf2288be2b675 Mon Sep 17 00:00:00 2001 From: zhangxiang Date: Mon, 31 Aug 2026 18:53:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(theme):=20=E6=9A=97=E9=BB=91=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=20Phase=202=20=E6=89=B9=E6=AC=A1=203=20=E2=80=94=20pr?= =?UTF-8?q?oduct-detail/standalone/detail-hero=20token=20=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - product-detail-content-v3.tsx: 9 处 bg-white → bg-bg-primary (Hero / features / benefits / process / cases / certifications / CTA) - standalone/[id]/client.tsx: 5 处 bg-white → bg-bg-primary - detail-hero.tsx: 浅色 variant bg-white → bg-bg-primary(共享组件) - detail.test.tsx: 新增常驻断言——light variant 必须用主题 token,禁止硬编码 bg-white 验证(evidence-first): - type-check 0 / lint 0 errors - jest 128 suites / 1624 passed(含新增断言) - 视觉回归 22 passed(浅色基线零 diff) - computed-style 一次性验证 4 passed: /products/erp + /products/crm 的 dark 反色 (html/body/header → #0A0E14、section 层次自动反色)+ light 零深色残留;脚本已删 Phase 2 剩余批次: 批次 4 admin 全量(user 决策: admin 也参与) --- .../products/product-detail-content-v3.tsx | 18 +++++++++--------- .../products/standalone/[id]/client.tsx | 12 ++++++------ src/components/detail/detail-hero.tsx | 2 +- src/components/detail/detail.test.tsx | 15 +++++++++++++++ 4 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/app/(marketing)/products/product-detail-content-v3.tsx b/src/app/(marketing)/products/product-detail-content-v3.tsx index d6cf67c..995a947 100644 --- a/src/app/(marketing)/products/product-detail-content-v3.tsx +++ b/src/app/(marketing)/products/product-detail-content-v3.tsx @@ -26,7 +26,7 @@ function DetailHero({ product }: DetailHeroProps) { const productIcon = PRODUCT_ICONS[product.title] || ; return ( -
+
(
@@ -157,7 +157,7 @@ interface BenefitsSectionProps { function BenefitsSection({ benefits }: BenefitsSectionProps) { return ( -
+
@@ -178,7 +178,7 @@ function BenefitsSection({ benefits }: BenefitsSectionProps) { {benefits.map((benefit, idx) => (
@@ -231,7 +231,7 @@ function ProcessSection({ process }: ProcessSectionProps) { {process.map((step, idx) => (
{idx + 1} @@ -256,7 +256,7 @@ function CaseStudiesSection({ caseStudies }: CaseStudiesSectionProps) { if (!caseStudies || caseStudies.length === 0) return null; return ( -
+
@@ -281,7 +281,7 @@ function CaseStudiesSection({ caseStudies }: CaseStudiesSectionProps) { {caseStudies.map((study) => (
@@ -350,7 +350,7 @@ function CertificationsSection({ certifications }: CertificationsSectionProps) { {certifications.map((cert, idx) => (
@@ -374,7 +374,7 @@ interface CTASectionProps { function CTASection({ product }: CTASectionProps) { return ( -
+
diff --git a/src/app/(marketing)/products/standalone/[id]/client.tsx b/src/app/(marketing)/products/standalone/[id]/client.tsx index 83789ce..034c276 100644 --- a/src/app/(marketing)/products/standalone/[id]/client.tsx +++ b/src/app/(marketing)/products/standalone/[id]/client.tsx @@ -68,7 +68,7 @@ export function StandaloneProductClient({ item }: StandaloneProductClientProps) /> {status === 'coming-soon' ? ( -
+
-
+

@@ -129,7 +129,7 @@ export function StandaloneProductClient({ item }: StandaloneProductClientProps)

) : ( <> -
+
{param.name}
{param.value}
@@ -207,7 +207,7 @@ export function StandaloneProductClient({ item }: StandaloneProductClientProps) )} {complianceCertifications.length > 0 && ( -
+
-
+
diff --git a/src/components/detail/detail-hero.tsx b/src/components/detail/detail-hero.tsx index 2a3eb6e..7491276 100644 --- a/src/components/detail/detail-hero.tsx +++ b/src/components/detail/detail-hero.tsx @@ -32,7 +32,7 @@ export function DetailHero({ const bgClass = isBrand ? 'bg-brand-section text-white' - : 'bg-white text-ink'; + : 'bg-bg-primary text-ink'; return (
diff --git a/src/components/detail/detail.test.tsx b/src/components/detail/detail.test.tsx index 8aedbfa..4e771fa 100644 --- a/src/components/detail/detail.test.tsx +++ b/src/components/detail/detail.test.tsx @@ -383,6 +383,21 @@ describe('DetailHero', () => { const section = container.querySelector('section'); expect(section).toBeInTheDocument(); }); + + it('should use theme-aware bg token (not hard-coded bg-white) for light variant', async () => { + const { DetailHero } = await import('./detail-hero'); + const { container } = render( + + ); + // 暗黑模式:浅色底色必须走 CSS 变量 token,dark 下才能随主题反色 + const section = container.querySelector('section'); + expect(section?.className).toContain('bg-bg-primary'); + expect(section?.className).not.toContain('bg-white'); + }); }); describe('ProductValueSection', () => {