refactor: 页面组件优化与墨韵分割线组件化
- 提取 AnimatedInkDivider 组件替代硬编码 ink-divider div - 重构各营销页面组件代码结构优化 - 修正统计数据:自研产品 4 -> 6 - 更新 about 页面测试用例
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { useState, useMemo, useRef, ChangeEvent } from 'react';
|
||||
import { useInView } from 'framer-motion';
|
||||
import { useState, useMemo, ChangeEvent } from 'react';
|
||||
import { NEWS } from '@/lib/constants';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
@@ -10,8 +9,9 @@ import { Button } from '@/components/ui/button';
|
||||
import { PageHeader } from '@/components/ui/page-header';
|
||||
import { Search, Calendar, Filter, ArrowRight, SearchX } from 'lucide-react';
|
||||
import { StaticLink } from '@/components/ui/static-link';
|
||||
import { motion } from 'framer-motion';
|
||||
import { Pagination } from '@/components/ui/pagination';
|
||||
import { InkReveal, StaggerContainer, StaggerItem } from '@/lib/animations';
|
||||
import { ScrollReveal } from '@/components/ui/scroll-animations';
|
||||
|
||||
const categories = ['全部', '公司新闻', '产品发布', '研发动态'];
|
||||
const ITEMS_PER_PAGE = 9;
|
||||
@@ -20,8 +20,7 @@ export default function NewsListPage() {
|
||||
const [selectedCategory, setSelectedCategory] = useState('全部');
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const contentRef = useRef(null);
|
||||
const isContentInView = useInView(contentRef, { once: true, margin: '-100px' });
|
||||
|
||||
const filteredNews = useMemo(() => {
|
||||
return NEWS.filter((newsItem) => {
|
||||
const matchesCategory = selectedCategory === '全部' || newsItem.category === selectedCategory;
|
||||
@@ -60,13 +59,9 @@ export default function NewsListPage() {
|
||||
description="了解睿新致远最新动态,把握行业发展脉搏"
|
||||
/>
|
||||
|
||||
<div className="container-wide relative z-10 py-12" ref={contentRef} id="page-content">
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={isContentInView ? { opacity: 1, y: 0 } : {}}
|
||||
transition={{ duration: 0.6 }}
|
||||
className="mb-8 space-y-4"
|
||||
>
|
||||
<div className="container-wide relative z-10 py-12" id="page-content">
|
||||
{/* 筛选区 - InkReveal */}
|
||||
<InkReveal className="mb-8 space-y-4">
|
||||
<div className="flex flex-col md:flex-row gap-4 items-start md:items-center">
|
||||
<div className="flex items-center gap-2 text-[#1C1C1C]">
|
||||
<Filter className="w-5 h-5" />
|
||||
@@ -101,7 +96,7 @@ export default function NewsListPage() {
|
||||
aria-label="搜索新闻"
|
||||
/>
|
||||
</div>
|
||||
</motion.div>
|
||||
</InkReveal>
|
||||
|
||||
{paginatedNews.length === 0 ? (
|
||||
<div className="text-center py-20">
|
||||
@@ -118,14 +113,10 @@ export default function NewsListPage() {
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{paginatedNews.map((newsItem, index) => (
|
||||
<motion.div
|
||||
key={newsItem.id}
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={isContentInView ? { opacity: 1, y: 0 } : {}}
|
||||
transition={{ duration: 0.5, delay: 0.2 + index * 0.1 }}
|
||||
>
|
||||
{/* 卡片网格 - StaggerContainer */}
|
||||
<StaggerContainer className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6" staggerDelay={0.08}>
|
||||
{paginatedNews.map((newsItem) => (
|
||||
<StaggerItem key={newsItem.id}>
|
||||
<StaticLink href={`/news/${newsItem.id}`}>
|
||||
<Card className="h-full hover:shadow-lg transition-shadow cursor-pointer border-[#E5E5E5] hover:border-[var(--color-brand-primary)]">
|
||||
<CardContent className="p-0">
|
||||
@@ -164,9 +155,9 @@ export default function NewsListPage() {
|
||||
</CardContent>
|
||||
</Card>
|
||||
</StaticLink>
|
||||
</motion.div>
|
||||
</StaggerItem>
|
||||
))}
|
||||
</div>
|
||||
</StaggerContainer>
|
||||
|
||||
<Pagination currentPage={currentPage} totalPages={totalPages} onPageChange={handlePageChange} scrollTargetId="page-content" />
|
||||
|
||||
@@ -176,21 +167,23 @@ export default function NewsListPage() {
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Bottom CTA */}
|
||||
<div className="mt-12 text-center py-16 bg-[#F5F5F5] rounded-2xl">
|
||||
<h3 className="text-xl md:text-2xl font-semibold text-[#1C1C1C] mb-3">
|
||||
想获取最新行业资讯?
|
||||
</h3>
|
||||
<p className="text-[#5C5C5C] mb-6 max-w-lg mx-auto">
|
||||
关注我们的公众号,第一时间了解数字化转型趋势和公司动态
|
||||
</p>
|
||||
<Button size="lg" className="bg-[var(--color-brand-primary)] hover:bg-[var(--color-brand-primary-hover)] text-white" asChild>
|
||||
<StaticLink href="/contact">
|
||||
联系我们
|
||||
<ArrowRight className="ml-2 w-4 h-4" />
|
||||
</StaticLink>
|
||||
</Button>
|
||||
</div>
|
||||
{/* CTA - ScrollReveal */}
|
||||
<ScrollReveal>
|
||||
<div className="mt-12 text-center py-16 bg-[#F5F5F5] rounded-2xl">
|
||||
<h3 className="text-xl md:text-2xl font-semibold text-[#1C1C1C] mb-3">
|
||||
想获取最新行业资讯?
|
||||
</h3>
|
||||
<p className="text-[#5C5C5C] mb-6 max-w-lg mx-auto">
|
||||
关注我们的公众号,第一时间了解数字化转型趋势和公司动态
|
||||
</p>
|
||||
<Button size="lg" className="bg-[var(--color-brand-primary)] hover:bg-[var(--color-brand-primary-hover)] text-white" asChild>
|
||||
<StaticLink href="/contact">
|
||||
联系我们
|
||||
<ArrowRight className="ml-2 w-4 h-4" />
|
||||
</StaticLink>
|
||||
</Button>
|
||||
</div>
|
||||
</ScrollReveal>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user