fix(qa): 第五轮系统性质量保障缺陷修复 + 单元/集成测试
安全/鉴权:登出清服务端 httpOnly 令牌、登录 IP 限流前置 bcrypt、停用账号 令牌在 6 个内联 role handler 失效、admin/items 存在性 oracle 认证前置、 同意偏好 sanitize fail-closed、api-crypto 按 HTTP 方法判体。 CMS:workflow 状态更新+审计收进交互式 $transaction(失败即回滚)、编辑器 richtext 走 textarea 防换行损毁、array/object 子字段按作用域读写防污染、 about/contact/erp-upgrade 补 ISR revalidate 与路由映射。 UI/a11y:AnimatedCounter 入视口前显起点、CLS 累计上报、MetricCard 动画入 effect 并卸载取消 rAF、后台状态四态映射/搜索防抖+序号守卫/媒体单 input/ 吞错改横幅/表单 label-aria 关联。 新增对应判别性单测与 pagination/rate-limit/client-ip/sanitize/validate-content-data 等模块及 tests-integration 真库集成层。
This commit is contained in:
1 parent
040951c0a3
commit
a366bd1400
224 files changed
+8938
-5579
No files matched your search
@@ -75,12 +75,12 @@ export function CaseStudiesSection({
|
||||
{caseStudies.map((study) => (
|
||||
<div
|
||||
key={study.client}
|
||||
className="group relative block h-full overflow-hidden bg-bg-primary transition-all duration-300 hover:bg-bg-secondary"
|
||||
className="group relative block h-full overflow-hidden bg-bg-primary transition-all duration-normal hover:bg-bg-secondary"
|
||||
>
|
||||
<div className="aspect-[4/3] bg-gradient-to-br from-bg-secondary to-bg-tertiary relative overflow-hidden">
|
||||
<div className="absolute inset-0 flex items-center justify-center">
|
||||
{/* 客户名首字作占位图形(无真实配图时),纯装饰 → aria-hidden 豁免对比度 */}
|
||||
<span aria-hidden="true" className="text-6xl font-bold text-text-muted/10">
|
||||
{/* 客户名首字占位图形(无真实配图时):aria-hidden 不豁免 1.4.3,用大字档令牌 text-text-hint */}
|
||||
<span aria-hidden="true" className="text-6xl font-bold text-text-hint">
|
||||
{study.client.charAt(0)}
|
||||
</span>
|
||||
</div>
|
||||
@@ -92,7 +92,7 @@ export function CaseStudiesSection({
|
||||
</div>
|
||||
|
||||
<div className="p-8">
|
||||
<h3 className="text-xl font-bold text-ink mb-3 group-hover:translate-x-2 transition-transform duration-300">
|
||||
<h3 className="text-xl font-bold text-ink mb-3 group-hover:translate-x-2 transition-transform duration-normal">
|
||||
{study.client}
|
||||
</h3>
|
||||
<p className="text-text-secondary text-sm leading-relaxed mb-6">
|
||||
|
||||
@@ -14,7 +14,7 @@ export function CaseStudyCard({ study, index }: CaseStudyCardProps) {
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, margin: '-50px' }}
|
||||
transition={{ duration: 0.3, delay: index * 0.06 }}
|
||||
transition={{ duration: 0.28, delay: index * 0.06 }}
|
||||
className="rounded-xl border border-border-primary bg-bg-elevated p-6 shadow-sm transition-shadow hover:shadow-md"
|
||||
>
|
||||
<div className="mb-3 flex items-center gap-2">
|
||||
|
||||
@@ -21,7 +21,7 @@ export function CertificationList({ certifications }: CertificationListProps) {
|
||||
initial: { opacity: 0, scale: 0.95 },
|
||||
whileInView: { opacity: 1, scale: 1 },
|
||||
viewport: { once: true, margin: '-50px' },
|
||||
transition: { duration: 0.3, delay: index * 0.05 },
|
||||
transition: { duration: 0.28, delay: index * 0.05 },
|
||||
className,
|
||||
};
|
||||
const inner = (
|
||||
|
||||
@@ -57,7 +57,7 @@ export function CertificationsSection({ certifications }: CertificationsSectionP
|
||||
{certifications.map((cert, idx) => (
|
||||
<div
|
||||
key={idx}
|
||||
className="group flex items-center gap-4 px-8 py-5 bg-bg-primary hover:bg-bg-secondary transition-all duration-300"
|
||||
className="group flex items-center gap-4 px-8 py-5 bg-bg-primary hover:bg-bg-secondary transition-all duration-normal"
|
||||
>
|
||||
<div className="w-12 h-12 rounded-xl bg-brand-soft flex items-center justify-center text-brand-ink">
|
||||
<Shield className="w-6 h-6" />
|
||||
|
||||
@@ -38,7 +38,7 @@ export function DetailCTASection({
|
||||
initial={{ opacity: 0, y: 32 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, margin: '-100px' }}
|
||||
transition={{ duration: 0.3, ease: [0.22, 1, 0.36, 1] }}
|
||||
transition={{ duration: 0.28, ease: [0.22, 1, 0.36, 1] }}
|
||||
className="max-w-3xl"
|
||||
>
|
||||
{/* 标签 */}
|
||||
@@ -61,7 +61,7 @@ export function DetailCTASection({
|
||||
className="group inline-flex items-center gap-3 px-10 py-4 bg-white text-brand font-bold text-base hover:bg-white/90 transition-all duration-200"
|
||||
>
|
||||
<span>{primaryAction.label}</span>
|
||||
<ArrowRight className="w-5 h-5 transition-transform duration-300 group-hover:translate-x-1" />
|
||||
<ArrowRight className="w-5 h-5 transition-transform duration-normal group-hover:translate-x-1" />
|
||||
</a>
|
||||
|
||||
{secondaryAction && (
|
||||
@@ -78,7 +78,7 @@ export function DetailCTASection({
|
||||
initial={{ opacity: 0 }}
|
||||
whileInView={{ opacity: 1 }}
|
||||
viewport={{ once: true }}
|
||||
transition={{ delay: 0.5, duration: 0.3 }}
|
||||
transition={{ delay: 0.5, duration: 0.28 }}
|
||||
className="mt-10 text-sm text-white/70"
|
||||
>
|
||||
平均响应时间 < 2小时 · 7×24小时技术支持 · 无需预付费用
|
||||
|
||||
@@ -69,7 +69,7 @@ export function DetailHero({
|
||||
scale: 1,
|
||||
filter: 'blur(0px)',
|
||||
transition: {
|
||||
duration: 0.3,
|
||||
duration: 0.28,
|
||||
ease: [0.22, 1, 0.36, 1] as const,
|
||||
},
|
||||
},
|
||||
@@ -101,7 +101,7 @@ export function DetailHero({
|
||||
y: 0,
|
||||
filter: 'blur(0px)',
|
||||
transition: {
|
||||
duration: 0.3,
|
||||
duration: 0.28,
|
||||
ease: [0.22, 1, 0.36, 1] as const,
|
||||
},
|
||||
},
|
||||
@@ -120,7 +120,7 @@ export function DetailHero({
|
||||
opacity: 1,
|
||||
y: 0,
|
||||
transition: {
|
||||
duration: 0.3,
|
||||
duration: 0.28,
|
||||
delay: 0.25,
|
||||
ease: [0.22, 1, 0.36, 1] as const,
|
||||
},
|
||||
@@ -139,7 +139,7 @@ export function DetailHero({
|
||||
opacity: 1,
|
||||
y: 0,
|
||||
transition: {
|
||||
duration: 0.3,
|
||||
duration: 0.28,
|
||||
delay: 0.4,
|
||||
ease: [0.22, 1, 0.36, 1] as const,
|
||||
},
|
||||
@@ -159,7 +159,7 @@ export function DetailHero({
|
||||
opacity: 1,
|
||||
y: 0,
|
||||
transition: {
|
||||
duration: 0.3,
|
||||
duration: 0.28,
|
||||
delay: 0.55,
|
||||
ease: [0.22, 1, 0.36, 1] as const,
|
||||
},
|
||||
@@ -168,19 +168,23 @@ export function DetailHero({
|
||||
className={`mt-12 flex flex-wrap gap-5 ${isCenterLayout ? 'justify-center' : ''}`}
|
||||
>
|
||||
{primaryAction && (
|
||||
<a href={primaryAction.href}>
|
||||
<PressableButton variant="primary" className="px-10 py-4 text-base shadow-lg group">
|
||||
<span>{primaryAction.label}</span>
|
||||
<ArrowRight className="w-5 h-5 group-hover:translate-x-1 group-hover:-translate-y-0.5 transition-transform duration-300" />
|
||||
</PressableButton>
|
||||
</a>
|
||||
<PressableButton
|
||||
href={primaryAction.href}
|
||||
variant="primary"
|
||||
className="px-10 py-4 text-base shadow-lg group"
|
||||
>
|
||||
<span>{primaryAction.label}</span>
|
||||
<ArrowRight className="w-5 h-5 group-hover:translate-x-1 group-hover:-translate-y-0.5 transition-transform duration-normal" />
|
||||
</PressableButton>
|
||||
)}
|
||||
{secondaryAction && (
|
||||
<a href={secondaryAction.href}>
|
||||
<PressableButton variant="secondary" className="px-8 py-4 text-base">
|
||||
{secondaryAction.label}
|
||||
</PressableButton>
|
||||
</a>
|
||||
<PressableButton
|
||||
href={secondaryAction.href}
|
||||
variant="secondary"
|
||||
className="px-8 py-4 text-base"
|
||||
>
|
||||
{secondaryAction.label}
|
||||
</PressableButton>
|
||||
)}
|
||||
</motion.div>
|
||||
)}
|
||||
@@ -189,7 +193,7 @@ export function DetailHero({
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
transition={{ delay: 1.5, duration: 0.3 }}
|
||||
transition={{ delay: 1.5, duration: 0.28 }}
|
||||
className="absolute bottom-8 left-1/2 -translate-x-1/2"
|
||||
>
|
||||
<div
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import { motion, useInView } from 'framer-motion';
|
||||
import { useRef, useState } from 'react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import {
|
||||
CheckCircle2,
|
||||
ArrowRight,
|
||||
@@ -70,25 +70,31 @@ function MetricCard({
|
||||
const suffix = value.replace(/[0-9.]/g, '');
|
||||
const [displayValue, setDisplayValue] = useState('0');
|
||||
|
||||
if (isInView && displayValue === '0') {
|
||||
// 动画必须在 effect 中驱动并在卸载/重跑时取消。历史写法在 render 体内 setState +
|
||||
// requestAnimationFrame:每一帧的 setState 又触发重渲染并再 spawn 一条从 0 开始的动画链,
|
||||
// 相互竞争且从不取消(Q-6)。
|
||||
useEffect(() => {
|
||||
if (!isInView) return;
|
||||
if (isNaN(numericValue)) {
|
||||
setDisplayValue(value);
|
||||
} else {
|
||||
let startTime: number;
|
||||
const animate = (currentTime: number) => {
|
||||
if (!startTime) startTime = currentTime;
|
||||
const progress = Math.min((currentTime - startTime) / 2000, 1);
|
||||
const easeOutQuart = 1 - Math.pow(1 - progress, 4);
|
||||
setDisplayValue(
|
||||
Number.isInteger(numericValue)
|
||||
? Math.floor(numericValue * easeOutQuart).toString() + suffix
|
||||
: (numericValue * easeOutQuart).toFixed(1) + suffix
|
||||
);
|
||||
if (progress < 1) requestAnimationFrame(animate);
|
||||
};
|
||||
requestAnimationFrame(animate);
|
||||
return;
|
||||
}
|
||||
}
|
||||
let frame = 0;
|
||||
let startTime: number | undefined;
|
||||
const animate = (currentTime: number) => {
|
||||
if (startTime === undefined) startTime = currentTime;
|
||||
const progress = Math.min((currentTime - startTime) / 2000, 1);
|
||||
const easeOutQuart = 1 - Math.pow(1 - progress, 4);
|
||||
setDisplayValue(
|
||||
Number.isInteger(numericValue)
|
||||
? Math.floor(numericValue * easeOutQuart).toString() + suffix
|
||||
: (numericValue * easeOutQuart).toFixed(1) + suffix,
|
||||
);
|
||||
if (progress < 1) frame = requestAnimationFrame(animate);
|
||||
};
|
||||
frame = requestAnimationFrame(animate);
|
||||
return () => cancelAnimationFrame(frame);
|
||||
}, [isInView, numericValue, suffix, value]);
|
||||
|
||||
return (
|
||||
<div className="bain-card p-8">
|
||||
@@ -120,7 +126,7 @@ export function ProductValueSection({ product }: ProductValueSectionProps) {
|
||||
initial={{ opacity: 0, y: 32 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, margin: '-120px' }}
|
||||
transition={{ duration: 0.3, ease: [0.22, 1, 0.36, 1] }}
|
||||
transition={{ duration: 0.28, ease: [0.22, 1, 0.36, 1] }}
|
||||
className="mb-16 sm:mb-20"
|
||||
>
|
||||
<div className="flex items-center gap-3 mb-6">
|
||||
@@ -149,7 +155,7 @@ export function ProductValueSection({ product }: ProductValueSectionProps) {
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true }}
|
||||
transition={{
|
||||
duration: 0.3,
|
||||
duration: 0.28,
|
||||
delay: index * 0.06,
|
||||
ease: [0.22, 1, 0.36, 1],
|
||||
}}
|
||||
@@ -190,7 +196,7 @@ export function ProductValueSection({ product }: ProductValueSectionProps) {
|
||||
whileInView={{ opacity: 1, x: 0 }}
|
||||
viewport={{ once: true }}
|
||||
transition={{
|
||||
duration: 0.3,
|
||||
duration: 0.28,
|
||||
delay: index * 0.06,
|
||||
ease: [0.22, 1, 0.36, 1],
|
||||
}}
|
||||
@@ -225,7 +231,7 @@ export function ProductValueSection({ product }: ProductValueSectionProps) {
|
||||
viewport={{ once: true }}
|
||||
transition={{
|
||||
delay: 0.3 + index * 0.05,
|
||||
duration: 0.3,
|
||||
duration: 0.28,
|
||||
ease: [0.22, 1, 0.36, 1],
|
||||
}}
|
||||
className="flex items-start gap-3 text-sm text-text-secondary"
|
||||
@@ -245,7 +251,7 @@ export function ProductValueSection({ product }: ProductValueSectionProps) {
|
||||
initial={{ opacity: 0, y: 32 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, margin: '-80px' }}
|
||||
transition={{ duration: 0.3, delay: 0.2 }}
|
||||
transition={{ duration: 0.28, delay: 0.2 }}
|
||||
className="mt-24"
|
||||
>
|
||||
<div className="mb-12">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { motion, useInView } from 'framer-motion';
|
||||
import { useRef, useEffect, useState } from 'react';
|
||||
import { useReducedMotion } from '@/hooks/use-reduced-motion';
|
||||
import { CaseStudyCard } from './detail-case-study';
|
||||
import { CertificationList } from './detail-certification';
|
||||
import type { CaseStudy, DataProof, Certification } from '@/lib/constants/products';
|
||||
@@ -19,6 +20,7 @@ function AnimatedCounter({ value, duration = 2000 }: { value: string; duration?:
|
||||
const [displayValue, setDisplayValue] = useState('0');
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
const isInView = useInView(ref, { once: true });
|
||||
const shouldReduceMotion = useReducedMotion();
|
||||
|
||||
useEffect(() => {
|
||||
if (!isInView) return;
|
||||
@@ -29,7 +31,19 @@ function AnimatedCounter({ value, duration = 2000 }: { value: string; duration?:
|
||||
return;
|
||||
}
|
||||
|
||||
const suffix = value.replace(/[0-9.]/g, '');
|
||||
const [, prefix = '', suffix = ''] = value.match(/^([^\d.]*)[\d.]+([^\d.]*)$/) ?? [];
|
||||
const finalText =
|
||||
prefix +
|
||||
(Number.isInteger(numericValue) ? numericValue.toString() : numericValue.toFixed(1)) +
|
||||
suffix;
|
||||
|
||||
// 尊重 prefers-reduced-motion:降级动效用户直接看到终值,不跑 2000ms rAF 计数。
|
||||
// MotionConfig reducedMotion="user" 只管 framer-motion 的动画属性,管不到裸 rAF(S-9)。
|
||||
if (shouldReduceMotion) {
|
||||
setDisplayValue(finalText);
|
||||
return;
|
||||
}
|
||||
|
||||
let startTime: number;
|
||||
let animationFrame: number;
|
||||
|
||||
@@ -40,9 +54,11 @@ function AnimatedCounter({ value, duration = 2000 }: { value: string; duration?:
|
||||
const currentValue = numericValue * easeOutQuart;
|
||||
|
||||
setDisplayValue(
|
||||
Number.isInteger(numericValue)
|
||||
? Math.floor(currentValue).toString() + suffix
|
||||
: currentValue.toFixed(1) + suffix
|
||||
prefix +
|
||||
(Number.isInteger(numericValue)
|
||||
? Math.floor(currentValue).toString()
|
||||
: currentValue.toFixed(1)) +
|
||||
suffix
|
||||
);
|
||||
|
||||
if (progress < 1) {
|
||||
@@ -53,7 +69,7 @@ function AnimatedCounter({ value, duration = 2000 }: { value: string; duration?:
|
||||
animationFrame = requestAnimationFrame(animate);
|
||||
|
||||
return () => cancelAnimationFrame(animationFrame);
|
||||
}, [isInView, value, duration]);
|
||||
}, [isInView, value, duration, shouldReduceMotion]);
|
||||
|
||||
return (
|
||||
<div ref={ref} className="text-3xl sm:text-4xl font-black text-brand-ink tabular-nums leading-none">
|
||||
@@ -80,7 +96,7 @@ export function DetailTrustSection({
|
||||
initial={{ opacity: 0, y: 24 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, margin: '-80px' }}
|
||||
transition={{ duration: 0.3, ease: [0.22, 1, 0.36, 1] }}
|
||||
transition={{ duration: 0.28, ease: [0.22, 1, 0.36, 1] }}
|
||||
className="mb-12"
|
||||
>
|
||||
<div className="flex items-center gap-3 mb-6">
|
||||
@@ -104,7 +120,7 @@ export function DetailTrustSection({
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, margin: '-60px' }}
|
||||
transition={{
|
||||
duration: 0.3,
|
||||
duration: 0.28,
|
||||
delay: index * 0.06,
|
||||
ease: [0.22, 1, 0.36, 1],
|
||||
}}
|
||||
@@ -129,7 +145,7 @@ export function DetailTrustSection({
|
||||
initial={{ opacity: 0, y: 24 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, margin: '-80px' }}
|
||||
transition={{ duration: 0.3, ease: [0.22, 1, 0.36, 1] }}
|
||||
transition={{ duration: 0.28, ease: [0.22, 1, 0.36, 1] }}
|
||||
className="mb-12"
|
||||
>
|
||||
<h2 className="text-2xl sm:text-3xl md:text-4xl lg:text-5xl font-black text-ink tracking-tight leading-[0.95]">
|
||||
@@ -145,7 +161,7 @@ export function DetailTrustSection({
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, margin: '-60px' }}
|
||||
transition={{
|
||||
duration: 0.3,
|
||||
duration: 0.28,
|
||||
delay: index * 0.06,
|
||||
ease: [0.22, 1, 0.36, 1],
|
||||
}}
|
||||
@@ -162,7 +178,7 @@ export function DetailTrustSection({
|
||||
initial={{ opacity: 0, y: 24 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, margin: '-80px' }}
|
||||
transition={{ duration: 0.3, ease: [0.22, 1, 0.36, 1] }}
|
||||
transition={{ duration: 0.28, ease: [0.22, 1, 0.36, 1] }}
|
||||
className="text-center"
|
||||
>
|
||||
<h3 className="text-lg font-semibold text-text-secondary mb-6">资质认证</h3>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect, jest } from '@jest/globals';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { render, screen, act } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom';
|
||||
|
||||
// ─── Mocks ───────────────────────────────────────────────────────────────
|
||||
@@ -445,6 +445,61 @@ describe('ProductValueSection', () => {
|
||||
expect(screen.queryByText('以可量化的目标约束交付')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('指标计数动画由 effect 驱动并在卸载时取消排队帧(Q-6 回归)', async () => {
|
||||
// Q-6:动画曾在 render 体内 setState + requestAnimationFrame——每帧 setState 又触发
|
||||
// 重渲染并重启一条新动画链,且从不 cancelAnimationFrame;卸载后帧回调继续排队。
|
||||
// 判别面:已排队的帧必须被逐一取消(sched === cancel),旧实现 sched>0 且 cancel=0 必红。
|
||||
jest.useFakeTimers();
|
||||
// faithful rAF 桩:cancel 必须真的撤销已排队的回调,否则「卸载后不再排队」无从判别
|
||||
const pending = new Map<number, ReturnType<typeof setTimeout>>();
|
||||
let handle = 0;
|
||||
const sched = jest.fn((cb: FrameRequestCallback) => {
|
||||
const id = ++handle;
|
||||
pending.set(
|
||||
id,
|
||||
setTimeout(() => {
|
||||
pending.delete(id);
|
||||
cb(Date.now());
|
||||
}, 16),
|
||||
);
|
||||
return id;
|
||||
});
|
||||
const cancel = jest.fn((id: number) => {
|
||||
const t = pending.get(id);
|
||||
if (t) clearTimeout(t);
|
||||
pending.delete(id);
|
||||
});
|
||||
const prevRaf = global.requestAnimationFrame;
|
||||
const prevCancel = global.cancelAnimationFrame;
|
||||
global.requestAnimationFrame = sched as unknown as typeof requestAnimationFrame;
|
||||
global.cancelAnimationFrame = cancel as unknown as typeof cancelAnimationFrame;
|
||||
try {
|
||||
const { ProductValueSection } = await import('./detail-product-value');
|
||||
const { container, unmount } = render(<ProductValueSection product={mockProduct} />);
|
||||
const card = container.querySelector('.tabular-nums') as HTMLElement;
|
||||
expect(card.textContent).toBe('0');
|
||||
await act(async () => {
|
||||
jest.advanceTimersByTime(200);
|
||||
});
|
||||
// 动画真的在推进(中途值),而不是停在 0 或瞬间跳终值
|
||||
expect(card.textContent).not.toBe('0');
|
||||
expect(card.textContent).not.toBe('300%');
|
||||
const scheduledBeforeUnmount = sched.mock.calls.length;
|
||||
expect(scheduledBeforeUnmount).toBeGreaterThan(0);
|
||||
unmount();
|
||||
await act(async () => {
|
||||
jest.advanceTimersByTime(3000);
|
||||
});
|
||||
// 泄漏判别:卸载后动画链必须死透——旧实现(render 期 rAF、从不 cancel)
|
||||
// 在这里会继续排队每一帧;effect 版在 cleanup 里 cancel 掉最后一帧。
|
||||
expect(sched.mock.calls.length).toBe(scheduledBeforeUnmount);
|
||||
} finally {
|
||||
global.requestAnimationFrame = prevRaf;
|
||||
global.cancelAnimationFrame = prevCancel;
|
||||
jest.useRealTimers();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('DetailTrustSection', () => {
|
||||
|
||||
@@ -20,7 +20,6 @@ export { CertificationsSection } from './detail-certifications-section';
|
||||
export { SolutionValueSection } from './solution-value';
|
||||
export { ServiceValueSection } from './service-value';
|
||||
|
||||
export { ListPageHero } from './list-page-hero';
|
||||
export { ProductCard } from './product-card';
|
||||
export { SolutionCard } from './solution-service-card';
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ function SignalCard({ signal }: { signal: L3Signal }) {
|
||||
<div
|
||||
className={cn(
|
||||
'group relative h-full p-6 sm:p-8 rounded-lg border border-border-primary bg-bg-primary',
|
||||
'transition-all duration-300 ease-out',
|
||||
'transition-all duration-normal ease-out',
|
||||
disabled
|
||||
? 'opacity-70 cursor-not-allowed'
|
||||
: 'hover:border-brand/40 hover:shadow-md hover:-translate-y-1'
|
||||
@@ -150,7 +150,7 @@ function SignalCard({ signal }: { signal: L3Signal }) {
|
||||
{title}
|
||||
{!disabled && (
|
||||
<ArrowUpRight
|
||||
className="w-4 h-4 transition-transform duration-300 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"
|
||||
className="w-4 h-4 transition-transform duration-normal group-hover:translate-x-0.5 group-hover:-translate-y-0.5"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
// @ts-nocheck
|
||||
import { describe, it, expect, jest } from '@jest/globals';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom';
|
||||
|
||||
// ─── Mocks ───────────────────────────────────────────────────────────────
|
||||
|
||||
jest.mock('framer-motion', () => ({
|
||||
motion: {
|
||||
div: ({ children, initial, animate, variants, whileInView, viewport, transition, className, ...props }: any) => (
|
||||
<div
|
||||
data-testid="motion-div"
|
||||
data-initial={JSON.stringify(initial)}
|
||||
data-animate={JSON.stringify(animate)}
|
||||
data-variants={JSON.stringify(variants)}
|
||||
data-while-inview={JSON.stringify(whileInView)}
|
||||
data-viewport={JSON.stringify(viewport)}
|
||||
data-transition={JSON.stringify(transition)}
|
||||
className={className}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
),
|
||||
h1: ({ children, className, ...props }: any) => (
|
||||
<h1 data-testid="motion-h1" className={className} {...props}>{children}</h1>
|
||||
),
|
||||
p: ({ children, className, ...props }: any) => (
|
||||
<p data-testid="motion-p" className={className} {...props}>{children}</p>
|
||||
),
|
||||
},
|
||||
useInView: jest.fn(() => true),
|
||||
AnimatePresence: ({ children }: any) => <>{children}</>,
|
||||
}));
|
||||
|
||||
jest.mock('@/hooks/use-reduced-motion', () => ({
|
||||
useReducedMotion: jest.fn(() => false),
|
||||
}));
|
||||
|
||||
// ─── Tests ───────────────────────────────────────────────────────────────
|
||||
|
||||
describe('ListPageHero', () => {
|
||||
it('should render title', async () => {
|
||||
const { ListPageHero } = await import('./list-page-hero');
|
||||
render(<ListPageHero title="产品服务" subtitle="企业数字化转型全方位解决方案" />);
|
||||
expect(screen.getByText('产品服务')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should render subtitle', async () => {
|
||||
const { ListPageHero } = await import('./list-page-hero');
|
||||
render(<ListPageHero title="产品服务" subtitle="企业数字化转型全方位解决方案" />);
|
||||
expect(screen.getByText('企业数字化转型全方位解决方案')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should render description when provided', async () => {
|
||||
const { ListPageHero } = await import('./list-page-hero');
|
||||
render(
|
||||
<ListPageHero
|
||||
title="产品服务"
|
||||
subtitle="企业数字化转型全方位解决方案"
|
||||
description="覆盖企业全业务场景的产品矩阵"
|
||||
/>
|
||||
);
|
||||
expect(screen.getByText('覆盖企业全业务场景的产品矩阵')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should not render description when not provided', async () => {
|
||||
const { ListPageHero } = await import('./list-page-hero');
|
||||
render(<ListPageHero title="产品服务" subtitle="企业数字化转型全方位解决方案" />);
|
||||
expect(screen.queryByText('覆盖企业全业务场景的产品矩阵')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should render badge when provided', async () => {
|
||||
const { ListPageHero } = await import('./list-page-hero');
|
||||
render(
|
||||
<ListPageHero
|
||||
title="产品服务"
|
||||
subtitle="企业数字化转型全方位解决方案"
|
||||
badge={{ text: '新品发布', variant: 'brand' }}
|
||||
/>
|
||||
);
|
||||
expect(screen.getByText('新品发布')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should not render badge when not provided', async () => {
|
||||
const { ListPageHero } = await import('./list-page-hero');
|
||||
render(<ListPageHero title="产品服务" subtitle="企业数字化转型全方位解决方案" />);
|
||||
expect(screen.queryByText('新品发布')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should render stats when provided', async () => {
|
||||
const { ListPageHero } = await import('./list-page-hero');
|
||||
const stats = [
|
||||
{ value: '6', label: '企业套装' },
|
||||
{ value: '3', label: '专业产品' },
|
||||
];
|
||||
render(
|
||||
<ListPageHero
|
||||
title="产品服务"
|
||||
subtitle="企业数字化转型全方位解决方案"
|
||||
stats={stats}
|
||||
/>
|
||||
);
|
||||
expect(screen.getByText('6')).toBeInTheDocument();
|
||||
expect(screen.getByText('企业套装')).toBeInTheDocument();
|
||||
expect(screen.getByText('3')).toBeInTheDocument();
|
||||
expect(screen.getByText('专业产品')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should not render stats when not provided', async () => {
|
||||
const { ListPageHero } = await import('./list-page-hero');
|
||||
render(<ListPageHero title="产品服务" subtitle="企业数字化转型全方位解决方案" />);
|
||||
expect(screen.queryByText('6')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should render with badge variant "blue"', async () => {
|
||||
const { ListPageHero } = await import('./list-page-hero');
|
||||
render(
|
||||
<ListPageHero
|
||||
title="解决方案"
|
||||
subtitle="行业解决方案"
|
||||
badge={{ text: '推荐', variant: 'blue' }}
|
||||
/>
|
||||
);
|
||||
expect(screen.getByText('推荐')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should render with badge variant "green"', async () => {
|
||||
const { ListPageHero } = await import('./list-page-hero');
|
||||
render(
|
||||
<ListPageHero
|
||||
title="服务"
|
||||
subtitle="专业服务"
|
||||
badge={{ text: '热门', variant: 'green' }}
|
||||
/>
|
||||
);
|
||||
expect(screen.getByText('热门')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should render with badge variant "neutral"', async () => {
|
||||
const { ListPageHero } = await import('./list-page-hero');
|
||||
render(
|
||||
<ListPageHero
|
||||
title="案例"
|
||||
subtitle="客户案例"
|
||||
badge={{ text: '案例', variant: 'neutral' }}
|
||||
/>
|
||||
);
|
||||
const neutralBadges = screen.getAllByText('案例');
|
||||
expect(neutralBadges.length).toBeGreaterThanOrEqual(1);
|
||||
});
|
||||
});
|
||||
@@ -1,166 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { motion } from 'framer-motion';
|
||||
import { useReducedMotion } from '@/hooks/use-reduced-motion';
|
||||
|
||||
interface ListPageHeroProps {
|
||||
title: string;
|
||||
subtitle: string;
|
||||
description?: string;
|
||||
stats?: Array<{ value: string; label: string }>;
|
||||
badge?: {
|
||||
text: string;
|
||||
variant?: 'brand' | 'blue' | 'green' | 'neutral';
|
||||
};
|
||||
}
|
||||
|
||||
const BADGE_VARIANTS = {
|
||||
brand: {
|
||||
bg: 'var(--color-brand-bg)',
|
||||
text: 'var(--color-brand)',
|
||||
border: 'rgba(var(--color-brand-rgb), 0.15)',
|
||||
dot: 'var(--color-brand)',
|
||||
},
|
||||
blue: {
|
||||
bg: 'rgba(var(--color-accent-blue-rgb), 0.08)',
|
||||
text: 'var(--color-accent-blue)',
|
||||
border: 'rgba(var(--color-accent-blue-rgb), 0.15)',
|
||||
dot: 'var(--color-accent-blue)',
|
||||
},
|
||||
green: {
|
||||
bg: 'rgba(34, 197, 94, 0.08)',
|
||||
text: '#16a34a',
|
||||
border: 'rgba(34, 197, 94, 0.15)',
|
||||
dot: '#22c55e',
|
||||
},
|
||||
neutral: {
|
||||
bg: 'var(--color-bg-section)',
|
||||
text: 'var(--color-text-secondary)',
|
||||
border: 'var(--color-border-primary)',
|
||||
dot: 'var(--color-text-subtle)',
|
||||
},
|
||||
};
|
||||
|
||||
export function ListPageHero({
|
||||
title,
|
||||
subtitle,
|
||||
description,
|
||||
stats,
|
||||
badge,
|
||||
}: ListPageHeroProps) {
|
||||
const shouldReduceMotion = useReducedMotion();
|
||||
const badgeStyle = BADGE_VARIANTS[badge?.variant || 'brand'];
|
||||
|
||||
return (
|
||||
<section className="relative overflow-hidden">
|
||||
{/* Multi-layer background */}
|
||||
<div className="absolute inset-0 bg-gradient-to-br from-[var(--color-bg-section)] via-[var(--color-bg-secondary)] to-[var(--color-bg-section)]" />
|
||||
<div className="absolute inset-0 bg-[radial-gradient(ellipse_at_top_right,_rgba(var(--color-brand-rgb),_0.05)_0%,_transparent_50%)]" />
|
||||
<div className="absolute inset-0 bg-[radial-gradient(ellipse_at_bottom_left,_rgba(var(--color-brand-rgb),_0.03)_0%,_transparent_50%)]" />
|
||||
|
||||
{/* Subtle grid texture */}
|
||||
<div
|
||||
className="absolute inset-0 opacity-[0.03]"
|
||||
style={{
|
||||
backgroundImage:
|
||||
'linear-gradient(rgba(var(--color-border-primary-rgb), 0.5) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--color-border-primary-rgb), 0.5) 1px, transparent 1px)',
|
||||
backgroundSize: '60px 60px',
|
||||
}}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
|
||||
{/* Decorative accent line */}
|
||||
<div className="absolute top-0 left-0 right-0 h-px" style={{ background: 'linear-gradient(90deg, transparent, var(--color-brand), transparent)' }} aria-hidden="true" />
|
||||
|
||||
<div className="container-wide relative z-10 py-20 lg:py-28">
|
||||
<motion.div
|
||||
initial={shouldReduceMotion ? {} : { opacity: 0, y: 20 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true }}
|
||||
transition={{ duration: 0.3, ease: [0.16, 1, 0.3, 1] }}
|
||||
className="max-w-4xl mx-auto text-center"
|
||||
>
|
||||
{/* Dynamic Badge */}
|
||||
{badge && badge.text && (
|
||||
<motion.div
|
||||
initial={shouldReduceMotion ? {} : { opacity: 0, scale: 0.95, y: 8 }}
|
||||
whileInView={{ opacity: 1, scale: 1, y: 0 }}
|
||||
viewport={{ once: true }}
|
||||
transition={{ delay: 0.1, duration: 0.3, ease: [0.16, 1, 0.3, 1] }}
|
||||
className="inline-flex items-center gap-2 px-4 py-1.5 rounded-full text-sm font-medium mb-6 backdrop-blur-sm"
|
||||
style={{ backgroundColor: badgeStyle.bg, color: badgeStyle.text, border: `1px solid ${badgeStyle.border}` }}
|
||||
>
|
||||
<span className="w-2 h-2 rounded-full animate-pulse" style={{ backgroundColor: badgeStyle.dot }} />
|
||||
{badge?.text || ''}
|
||||
</motion.div>
|
||||
)}
|
||||
|
||||
{/* Title */}
|
||||
<motion.h1
|
||||
initial={shouldReduceMotion ? {} : { opacity: 0, y: 24 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true }}
|
||||
transition={{ delay: 0.15, duration: 0.3, ease: [0.16, 1, 0.3, 1] }}
|
||||
className="text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight mb-6 text-[var(--color-text-primary)]"
|
||||
>
|
||||
{title}
|
||||
</motion.h1>
|
||||
|
||||
{/* Subtitle */}
|
||||
<motion.p
|
||||
initial={shouldReduceMotion ? {} : { opacity: 0, y: 20 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true }}
|
||||
transition={{ delay: 0.25, duration: 0.3, ease: [0.16, 1, 0.3, 1] }}
|
||||
className="text-lg md:text-xl max-w-2xl mx-auto leading-relaxed mb-4 text-[var(--color-text-secondary)]"
|
||||
>
|
||||
{subtitle}
|
||||
</motion.p>
|
||||
|
||||
{/* Description */}
|
||||
{description && (
|
||||
<motion.p
|
||||
initial={shouldReduceMotion ? {} : { opacity: 0, y: 18 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true }}
|
||||
transition={{ delay: 0.35, duration: 0.3, ease: [0.16, 1, 0.3, 1] }}
|
||||
className="text-base max-w-xl mx-auto mb-10 text-[var(--color-text-muted)]"
|
||||
>
|
||||
{description}
|
||||
</motion.p>
|
||||
)}
|
||||
|
||||
{/* Stats Row */}
|
||||
{stats && stats.length > 0 && (
|
||||
<motion.div
|
||||
initial={shouldReduceMotion ? {} : { opacity: 0, y: 24 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true }}
|
||||
transition={{ delay: 0.4, duration: 0.3, ease: [0.16, 1, 0.3, 1] }}
|
||||
className="flex flex-wrap justify-center gap-8 md:gap-12 mt-12 pt-12 border-t border-[var(--color-border-primary)]"
|
||||
>
|
||||
{stats.map((stat, index) => (
|
||||
<motion.div
|
||||
key={stat.label}
|
||||
initial={shouldReduceMotion ? {} : { opacity: 0, scale: 0.95 }}
|
||||
whileInView={{ opacity: 1, scale: 1 }}
|
||||
viewport={{ once: true }}
|
||||
transition={{ delay: 0.5 + index * 0.08, duration: 0.3, ease: [0.16, 1, 0.3, 1] }}
|
||||
className="text-center min-w-[100px]"
|
||||
>
|
||||
<div className="text-3xl md:text-4xl font-bold tracking-tight text-[var(--color-text-primary)]">
|
||||
{stat.value}
|
||||
</div>
|
||||
<div className="text-sm mt-1 text-[var(--color-text-subtle)]">{stat.label}</div>
|
||||
</motion.div>
|
||||
))}
|
||||
</motion.div>
|
||||
)}
|
||||
</motion.div>
|
||||
</div>
|
||||
|
||||
{/* Bottom fade */}
|
||||
<div className="absolute bottom-0 left-0 right-0 h-20 bg-gradient-to-t from-[var(--color-bg-primary)] to-transparent pointer-events-none" aria-hidden="true" />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { describe, it, expect } from '@jest/globals';
|
||||
import { render } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom';
|
||||
import { PressableButton } from './micro-interactions';
|
||||
|
||||
// S-5 回归:带 href 的 PressableButton 必须渲染单个 <a>(可导航),而不是把 <button> 嵌进 <a>
|
||||
// —— 旧实现 `<a><motion.button/></a>` 是无效交互嵌套,SR 会同时播报「链接 + 按钮」。
|
||||
// 旧码下 `container.querySelector('button')` 不为 null ⇒ 本用例判红(真判别)。
|
||||
describe('PressableButton (S-5)', () => {
|
||||
it('renders a single anchor (no nested button) when href is provided', () => {
|
||||
const { container } = render(
|
||||
<PressableButton href="/products/erp" variant="primary">
|
||||
了解更多
|
||||
</PressableButton>
|
||||
);
|
||||
const anchor = container.querySelector('a[href="/products/erp"]');
|
||||
expect(anchor).not.toBeNull();
|
||||
expect(container.querySelector('button')).toBeNull();
|
||||
});
|
||||
|
||||
it('renders a button (not an anchor) when no href is provided', () => {
|
||||
const { container } = render(
|
||||
<PressableButton variant="secondary" onClick={() => {}}>
|
||||
点击
|
||||
</PressableButton>
|
||||
);
|
||||
expect(container.querySelector('button')).not.toBeNull();
|
||||
expect(container.querySelector('a')).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -129,31 +129,28 @@ export function PressableButton({
|
||||
'bg-transparent text-brand-ink hover:bg-brand/5',
|
||||
};
|
||||
|
||||
const content = (
|
||||
<motion.button
|
||||
whileHover={{ y: -1 }}
|
||||
whileTap={{ scale: 0.97, y: 0 }}
|
||||
transition={{
|
||||
type: 'spring',
|
||||
stiffness: 400,
|
||||
damping: 25,
|
||||
}}
|
||||
onClick={onClick}
|
||||
className={`inline-flex items-center gap-2 px-6 py-3 font-semibold rounded-md transition-all duration-fast ease-standard ${baseStyles[variant]} ${className}`}
|
||||
>
|
||||
{children}
|
||||
</motion.button>
|
||||
);
|
||||
const sharedCls = `inline-flex items-center gap-2 px-6 py-3 font-semibold rounded-md transition-all duration-fast ease-standard ${baseStyles[variant]} ${className}`;
|
||||
const pressMotion = {
|
||||
whileHover: { y: -1 },
|
||||
whileTap: { scale: 0.97, y: 0 },
|
||||
transition: { type: 'spring' as const, stiffness: 400, damping: 25 },
|
||||
};
|
||||
|
||||
// 有 href 时渲染单个 <a>(motion.a),而不是把 <button> 嵌进 <a>——后者是无效交互嵌套,
|
||||
// 屏幕阅读器会同时播报「链接 + 按钮」两个控件,Enter/Space 激活语义含糊(S-5)。
|
||||
if (href) {
|
||||
return (
|
||||
<a href={href} className="inline-block">
|
||||
{content}
|
||||
</a>
|
||||
<motion.a href={href} onClick={onClick} className={sharedCls} {...pressMotion}>
|
||||
{children}
|
||||
</motion.a>
|
||||
);
|
||||
}
|
||||
|
||||
return content;
|
||||
return (
|
||||
<motion.button onClick={onClick} className={sharedCls} {...pressMotion}>
|
||||
{children}
|
||||
</motion.button>
|
||||
);
|
||||
}
|
||||
|
||||
interface HoverLinkProps {
|
||||
|
||||
@@ -24,13 +24,13 @@ export function ProductCard({ product }: ProductCardProps) {
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true }}
|
||||
transition={{
|
||||
duration: 0.3,
|
||||
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 rounded-2xl bg-bg-elevated border border-border-primary overflow-hidden hover:border-brand/30 hover:shadow-lg hover:-translate-y-1 transition-all duration-300">
|
||||
<div className="relative h-full rounded-2xl bg-bg-elevated border border-border-primary overflow-hidden hover:border-brand/30 hover:shadow-lg hover:-translate-y-1 transition-all duration-normal">
|
||||
<div className="aspect-video relative overflow-hidden bg-bg-secondary">
|
||||
<Image
|
||||
src={product.image}
|
||||
|
||||
@@ -26,7 +26,7 @@ export function ServiceValueSection({ service }: ServiceValueSectionProps) {
|
||||
initial={{ opacity: 0, y: 32 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, margin: '-120px' }}
|
||||
transition={{ duration: 0.3, ease: [0.22, 1, 0.36, 1] }}
|
||||
transition={{ duration: 0.28, ease: [0.22, 1, 0.36, 1] }}
|
||||
className="mb-16 sm:mb-20"
|
||||
>
|
||||
<div className="flex items-center gap-3 mb-6">
|
||||
@@ -63,7 +63,7 @@ export function ServiceValueSection({ service }: ServiceValueSectionProps) {
|
||||
viewport={{ once: true }}
|
||||
transition={{
|
||||
delay: index * 0.06,
|
||||
duration: 0.3,
|
||||
duration: 0.28,
|
||||
ease: [0.22, 1, 0.36, 1],
|
||||
}}
|
||||
className="bain-card p-6"
|
||||
@@ -105,7 +105,7 @@ export function ServiceValueSection({ service }: ServiceValueSectionProps) {
|
||||
viewport={{ once: true }}
|
||||
transition={{
|
||||
delay: index * 0.06,
|
||||
duration: 0.3,
|
||||
duration: 0.28,
|
||||
ease: [0.22, 1, 0.36, 1],
|
||||
}}
|
||||
className="bain-card p-5 flex items-start gap-3"
|
||||
@@ -135,7 +135,7 @@ export function ServiceValueSection({ service }: ServiceValueSectionProps) {
|
||||
viewport={{ once: true }}
|
||||
transition={{
|
||||
delay: index * 0.06,
|
||||
duration: 0.3,
|
||||
duration: 0.28,
|
||||
ease: [0.22, 1, 0.36, 1],
|
||||
}}
|
||||
className="bain-card p-5"
|
||||
|
||||
@@ -37,13 +37,13 @@ export function SolutionCard({ solution }: SolutionCardProps) {
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true }}
|
||||
transition={{
|
||||
duration: 0.3,
|
||||
duration: 0.28,
|
||||
ease: [0.22, 1, 0.36, 1] as const,
|
||||
}}
|
||||
className="group"
|
||||
>
|
||||
<Link href={`/solutions/${solution.id}`} className="block">
|
||||
<div className="relative h-full rounded-2xl bg-bg-elevated border border-border-primary overflow-hidden hover:border-brand/30 hover:shadow-lg hover:-translate-y-1 transition-all duration-300">
|
||||
<div className="relative h-full rounded-2xl bg-bg-elevated border border-border-primary overflow-hidden hover:border-brand/30 hover:shadow-lg hover:-translate-y-1 transition-all duration-normal">
|
||||
<div className="aspect-video relative overflow-hidden bg-bg-secondary flex items-center justify-center">
|
||||
{solution.image ? (
|
||||
<Image
|
||||
@@ -117,19 +117,19 @@ export function ServiceCard({ service }: ServiceCardProps) {
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true }}
|
||||
transition={{
|
||||
duration: 0.3,
|
||||
duration: 0.28,
|
||||
ease: [0.22, 1, 0.36, 1] as const,
|
||||
}}
|
||||
className="group"
|
||||
>
|
||||
<Link href={`/services/${service.id}`} className="block">
|
||||
<div className="relative h-full rounded-2xl bg-bg-secondary border border-border-primary overflow-hidden hover:border-blue-300 hover:shadow-lg hover:-translate-y-1 transition-all duration-300">
|
||||
<div className="relative h-full rounded-2xl bg-bg-secondary border border-border-primary overflow-hidden hover:border-brand/30 hover:shadow-lg hover:-translate-y-1 transition-all duration-normal">
|
||||
<div className="p-8">
|
||||
<div className="w-14 h-14 rounded-2xl bg-gradient-to-br from-[var(--color-accent-blue)] to-[#1d4ed8] flex items-center justify-center mb-5 shadow-md shadow-brand group-hover:scale-110 transition-transform">
|
||||
<Cpu className="w-7 h-7 text-white" />
|
||||
<div className="w-14 h-14 rounded-2xl bg-accent-blue-soft flex items-center justify-center mb-5 shadow-sm group-hover:scale-110 transition-transform">
|
||||
<Cpu className="w-7 h-7 text-accent-blue" />
|
||||
</div>
|
||||
|
||||
<h3 className="text-xl font-bold text-ink mb-3 group-hover:text-blue-600 transition-colors">
|
||||
<h3 className="text-xl font-bold text-ink mb-3 group-hover:text-brand-ink transition-colors">
|
||||
{service.title}
|
||||
</h3>
|
||||
|
||||
@@ -142,7 +142,7 @@ export function ServiceCard({ service }: ServiceCardProps) {
|
||||
{service.features.slice(0, 3).map((feature) => (
|
||||
<span
|
||||
key={feature}
|
||||
className="px-2.5 py-1 rounded-md text-xs font-medium bg-bg-elevated text-blue-600 border border-border-primary"
|
||||
className="px-2.5 py-1 rounded-md text-xs font-medium bg-bg-elevated text-text-secondary border border-border-primary"
|
||||
>
|
||||
{feature.split(':')[0]}
|
||||
</span>
|
||||
@@ -150,7 +150,7 @@ export function ServiceCard({ service }: ServiceCardProps) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex items-center gap-2 text-sm font-semibold text-blue-600 group-hover:gap-3 transition-all">
|
||||
<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>
|
||||
|
||||
@@ -21,7 +21,7 @@ export function SolutionValueSection({ solution }: SolutionValueSectionProps) {
|
||||
initial={{ opacity: 0, y: 32 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, margin: '-120px' }}
|
||||
transition={{ duration: 0.3, ease: [0.22, 1, 0.36, 1] }}
|
||||
transition={{ duration: 0.28, ease: [0.22, 1, 0.36, 1] }}
|
||||
className="mb-16 sm:mb-20"
|
||||
>
|
||||
<div className="flex items-center gap-3 mb-6">
|
||||
@@ -45,7 +45,7 @@ export function SolutionValueSection({ solution }: SolutionValueSectionProps) {
|
||||
initial={{ opacity: 0, x: -30 }}
|
||||
whileInView={{ opacity: 1, x: 0 }}
|
||||
viewport={{ once: true, margin: '-80px' }}
|
||||
transition={{ duration: 0.3, ease: [0.22, 1, 0.36, 1] }}
|
||||
transition={{ duration: 0.28, ease: [0.22, 1, 0.36, 1] }}
|
||||
>
|
||||
<div className="bain-card p-8">
|
||||
<h3 className="text-xl font-bold text-ink mb-6 flex items-center gap-3">
|
||||
@@ -63,7 +63,7 @@ export function SolutionValueSection({ solution }: SolutionValueSectionProps) {
|
||||
viewport={{ once: true }}
|
||||
transition={{
|
||||
delay: index * 0.06,
|
||||
duration: 0.3,
|
||||
duration: 0.28,
|
||||
ease: [0.22, 1, 0.36, 1],
|
||||
}}
|
||||
className="flex items-start gap-3 text-text-secondary"
|
||||
@@ -81,7 +81,7 @@ export function SolutionValueSection({ solution }: SolutionValueSectionProps) {
|
||||
initial={{ opacity: 0, x: 30 }}
|
||||
whileInView={{ opacity: 1, x: 0 }}
|
||||
viewport={{ once: true, margin: '-80px' }}
|
||||
transition={{ duration: 0.3, delay: 0.15, ease: [0.22, 1, 0.36, 1] }}
|
||||
transition={{ duration: 0.28, delay: 0.15, ease: [0.22, 1, 0.36, 1] }}
|
||||
>
|
||||
<div className="bain-card p-8">
|
||||
<h3 className="text-xl font-bold text-ink mb-6 flex items-center gap-3">
|
||||
@@ -99,7 +99,7 @@ export function SolutionValueSection({ solution }: SolutionValueSectionProps) {
|
||||
viewport={{ once: true }}
|
||||
transition={{
|
||||
delay: 0.25 + index * 0.08,
|
||||
duration: 0.3,
|
||||
duration: 0.28,
|
||||
ease: [0.22, 1, 0.36, 1],
|
||||
}}
|
||||
className="flex items-start gap-3 text-text-secondary"
|
||||
@@ -119,7 +119,7 @@ export function SolutionValueSection({ solution }: SolutionValueSectionProps) {
|
||||
initial={{ opacity: 0, y: 32 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, margin: '-80px' }}
|
||||
transition={{ duration: 0.3, delay: 0.3 }}
|
||||
transition={{ duration: 0.28, delay: 0.3 }}
|
||||
>
|
||||
<div className="mb-12">
|
||||
<div className="flex items-center gap-3 mb-6">
|
||||
@@ -142,7 +142,7 @@ export function SolutionValueSection({ solution }: SolutionValueSectionProps) {
|
||||
viewport={{ once: true }}
|
||||
transition={{
|
||||
delay: index * 0.06,
|
||||
duration: 0.3,
|
||||
duration: 0.28,
|
||||
ease: [0.22, 1, 0.36, 1],
|
||||
}}
|
||||
className="bain-card p-7"
|
||||
@@ -164,7 +164,7 @@ export function SolutionValueSection({ solution }: SolutionValueSectionProps) {
|
||||
initial={{ opacity: 0, y: 32 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, margin: '-80px' }}
|
||||
transition={{ duration: 0.3, delay: 0.4 }}
|
||||
transition={{ duration: 0.28, delay: 0.4 }}
|
||||
className="mt-20"
|
||||
>
|
||||
<div className="mb-12">
|
||||
|
||||
Reference in new issue
Block a user