5ec2ad0043
refactor(card): 调整卡片背景色和边框颜色 refactor(badge): 修改徽章颜色变体 refactor(button): 更新按钮颜色样式 refactor(input): 调整输入框颜色方案 refactor(textarea): 修改文本区域颜色样式 refactor(header): 更新导航栏颜色 refactor(hero-section): 调整英雄区域颜色和渐变
92 lines
3.8 KiB
TypeScript
92 lines
3.8 KiB
TypeScript
'use client';
|
|
|
|
import { motion } from 'framer-motion';
|
|
import { useInView } from 'framer-motion';
|
|
import { useRef } from 'react';
|
|
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@/components/ui/card';
|
|
import { ArrowRight, Calendar } from 'lucide-react';
|
|
import { NEWS } from '@/lib/constants';
|
|
|
|
export function NewsSection() {
|
|
const ref = useRef(null);
|
|
const isInView = useInView(ref, { once: true, margin: '-100px' });
|
|
|
|
return (
|
|
<section id="news" className="py-24 bg-[#F5F5F5]" ref={ref}>
|
|
<div className="container-custom">
|
|
<motion.div
|
|
initial={{ opacity: 0, y: 20 }}
|
|
animate={isInView ? { opacity: 1, y: 0 } : {}}
|
|
transition={{ duration: 0.6 }}
|
|
className="text-center max-w-3xl mx-auto mb-16"
|
|
>
|
|
<span className="inline-flex items-center gap-2 px-4 py-2 rounded-full border border-[#1C1C1C]/20 bg-[#F5F5F5] text-[#1C1C1C] text-sm font-medium mb-4">
|
|
新闻动态
|
|
</span>
|
|
<h2 className="text-3xl sm:text-4xl lg:text-5xl font-bold text-[#1C1C1C] mb-6">
|
|
最新<span className="text-[#C41E3A]">资讯</span>
|
|
</h2>
|
|
<p className="text-lg text-[#5C5C5C]">
|
|
了解公司最新动态、行业资讯和技术分享
|
|
</p>
|
|
</motion.div>
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-8 max-w-5xl mx-auto">
|
|
{NEWS.slice(0, 4).map((news, idx) => (
|
|
<motion.div
|
|
key={news.id}
|
|
initial={{ opacity: 0, y: 20 }}
|
|
animate={isInView ? { opacity: 1, y: 0 } : {}}
|
|
transition={{ duration: 0.5, delay: 0.1 + idx * 0.1 }}
|
|
>
|
|
<Card className="h-full flex flex-col group cursor-pointer border-[#E5E5E5] hover:border-[#1C1C1C]">
|
|
<CardHeader>
|
|
<div className="flex items-center gap-2 mb-3">
|
|
<span className="inline-block px-2 py-0.5 rounded-full bg-[#F5F5F5] text-[#1C1C1C] text-xs font-medium">
|
|
{news.category}
|
|
</span>
|
|
<span className="text-sm text-[#5C5C5C] flex items-center gap-1">
|
|
<Calendar className="w-3 h-3" />
|
|
{news.date}
|
|
</span>
|
|
</div>
|
|
<CardTitle className="text-xl leading-tight">{news.title}</CardTitle>
|
|
</CardHeader>
|
|
<CardContent className="flex-1 flex flex-col">
|
|
<CardDescription className="text-base leading-relaxed mb-6 flex-1">
|
|
{news.excerpt}
|
|
</CardDescription>
|
|
<a
|
|
href={`/news/${news.id}`}
|
|
className="inline-flex items-center text-sm font-medium text-[#1C1C1C] hover:text-[#C41E3A] transition-colors group/link"
|
|
>
|
|
阅读更多
|
|
<ArrowRight className="ml-1 w-4 h-4 transition-transform group-hover/link:translate-x-1" />
|
|
</a>
|
|
</CardContent>
|
|
</Card>
|
|
</motion.div>
|
|
))}
|
|
</div>
|
|
|
|
<motion.div
|
|
initial={{ opacity: 0, y: 20 }}
|
|
animate={isInView ? { opacity: 1, y: 0 } : {}}
|
|
transition={{ duration: 0.6, delay: 0.5 }}
|
|
className="mt-12 text-center"
|
|
>
|
|
<button
|
|
onClick={() => {
|
|
alert('更多新闻功能开发中...');
|
|
}}
|
|
className="inline-flex items-center text-sm font-medium text-[#1C1C1C] hover:text-[#C41E3A] transition-colors bg-transparent border-none cursor-pointer group"
|
|
>
|
|
查看全部新闻
|
|
<ArrowRight className="ml-1 w-4 h-4 transition-transform group-hover:translate-x-1" />
|
|
</button>
|
|
</motion.div>
|
|
</div>
|
|
</section>
|
|
);
|
|
}
|