Files
novalon-website/src/components/ui/ink-glow-card.tsx
T
张翔 a272e58aaa feat: 统一全站设计风格、导航组件与文案逻辑自洽性修复
- 新增 InkGlowCard 墨韵流光卡片组件,统一全站卡片交互风格
- 新增 PageNav 面包屑组件,统一全站页面导航
- 统一色彩体系、排版层级、间距节奏和动画风格
- 修复 CTA 区品牌名称错误(诺瓦隆→睿新致遠)
- 修复 ERP 产品卖点与年费制定价矛盾
- 导航下拉补充 SDS 和 OA 产品
- 统一全站数据指标为 12+年核心团队经验、6自研产品、10+团队成员
- 移除不可靠的 100%客户满意度和 30+行业专家指标
- 修复新闻时间线不合理问题,调整里程碑节奏
- 统一响应承诺为工作日快速响应
- 服务第4项重命名为行业方案实施,厘清概念
- 服务详情页效果数据改为定性描述
- 删除 cases 模块,精简代码库
2026-05-02 08:11:47 +08:00

112 lines
3.3 KiB
TypeScript

'use client';
import { useRef, useState, useCallback, type ReactNode } from 'react';
import { motion } from 'framer-motion';
interface InkGlowCardProps {
children: ReactNode;
index?: number;
accentColorRgb?: string;
glowStart?: string;
glowEnd?: string;
className?: string;
href?: string;
onClick?: () => void;
}
const DEFAULT_ACCENT = '196, 30, 58';
const DEFAULT_GLOW_START = '#C41E3A';
const DEFAULT_GLOW_END = '#D97706';
export function InkGlowCard({
children,
index = 0,
accentColorRgb = DEFAULT_ACCENT,
glowStart = DEFAULT_GLOW_START,
glowEnd = DEFAULT_GLOW_END,
className = '',
href,
onClick,
}: InkGlowCardProps) {
const cardRef = useRef<HTMLDivElement>(null);
const [mousePos, setMousePos] = useState({ x: 0, y: 0 });
const [isHovered, setIsHovered] = useState(false);
const handleMouseMove = useCallback((e: React.MouseEvent) => {
if (!cardRef.current) return;
const rect = cardRef.current.getBoundingClientRect();
setMousePos({
x: e.clientX - rect.left,
y: e.clientY - rect.top,
});
}, []);
const content = (
<>
<div
className="absolute inset-0 pointer-events-none transition-opacity duration-500"
style={{
opacity: isHovered ? 1 : 0,
background: `radial-gradient(400px circle at ${mousePos.x}px ${mousePos.y}px, rgba(${accentColorRgb}, 0.04), transparent 40%)`,
}}
/>
<div className="relative z-10">{children}</div>
</>
);
return (
<motion.div
ref={cardRef}
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{
duration: 0.5,
delay: index * 0.08,
ease: [0.16, 1, 0.3, 1],
}}
className={`relative ink-glow-border rounded-2xl ${className}`}
style={{
'--glow-start': glowStart,
'--glow-end': glowEnd,
} as React.CSSProperties}
>
{href ? (
<a
href={href}
className="relative block rounded-2xl bg-white overflow-hidden transition-all duration-500"
style={{
boxShadow: isHovered
? `0 16px 32px rgba(0,0,0,0.08), 0 0 0 1px rgba(${accentColorRgb}, 0.08)`
: '0 1px 3px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.06)',
transform: isHovered ? 'translateY(-4px)' : 'translateY(0)',
}}
onMouseMove={handleMouseMove}
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
>
{content}
</a>
) : (
<div
className="relative rounded-2xl bg-white overflow-hidden transition-all duration-500"
style={{
boxShadow: isHovered
? `0 16px 32px rgba(0,0,0,0.08), 0 0 0 1px rgba(${accentColorRgb}, 0.08)`
: '0 1px 3px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.06)',
transform: isHovered ? 'translateY(-4px)' : 'translateY(0)',
}}
onMouseMove={handleMouseMove}
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
onClick={onClick}
role={onClick ? 'button' : undefined}
tabIndex={onClick ? 0 : undefined}
>
{content}
</div>
)}
</motion.div>
);
}