'use client'; import { useState, useMemo, ChangeEvent, useEffect } from 'react'; import { motion } from 'framer-motion'; import { useReducedMotion } from '@/hooks/use-reduced-motion'; import { NEWS, COMPANY_INFO } from '@/lib/constants'; import { Badge } from '@/components/ui/badge'; import { Input } from '@/components/ui/input'; import { Button } from '@/components/ui/button'; import { StaticLink } from '@/components/ui/static-link'; import { LoadingState } from '@/components/ui/loading-state'; import { InkCard } from '@/components/ui/ink-wash'; import { Search, Calendar, ChevronLeft, ChevronRight, ArrowRight, Newspaper } from 'lucide-react'; const EASE = [0.25, 1, 0.5, 1] as const; const categories = ['全部', '公司新闻', '研发动态']; const ITEMS_PER_PAGE = 9; export default function NewsListPage() { const shouldReduceMotion = useReducedMotion(); const [selectedCategory, setSelectedCategory] = useState('全部'); const [searchQuery, setSearchQuery] = useState(''); const [currentPage, setCurrentPage] = useState(1); const [isLoading, setIsLoading] = useState(true); useEffect(() => { const timer = setTimeout(() => setIsLoading(false), 600); return () => clearTimeout(timer); }, []); const filteredNews = useMemo(() => { return NEWS.filter((newsItem) => { const matchesCategory = selectedCategory === '全部' || newsItem.category === selectedCategory; const matchesSearch = newsItem.title.toLowerCase().includes(searchQuery.toLowerCase()) || newsItem.excerpt.toLowerCase().includes(searchQuery.toLowerCase()); return matchesCategory && matchesSearch; }); }, [selectedCategory, searchQuery]); const totalPages = Math.ceil(filteredNews.length / ITEMS_PER_PAGE); const paginatedNews = useMemo(() => { const startIndex = (currentPage - 1) * ITEMS_PER_PAGE; return filteredNews.slice(startIndex, startIndex + ITEMS_PER_PAGE); }, [filteredNews, currentPage]); const handlePageChange = (page: number) => { setCurrentPage(page); window.scrollTo({ top: 0, behavior: 'smooth' }); }; const handleCategoryChange = (category: string) => { setSelectedCategory(category); setCurrentPage(1); }; const handleSearchChange = (e: ChangeEvent) => { setSearchQuery(e.target.value); setCurrentPage(1); }; return (
{/* Hero */}
新闻动态

了解行业趋势,把握数字化脉搏

新闻动态

{COMPANY_INFO.displayName}最新动态、产品更新与行业洞察

{/* Filters + List */}
{categories.map((category) => ( ))}
{paginatedNews.length === 0 ? (

没有找到相关新闻

) : ( <>
{paginatedNews.map((newsItem, index) => ( {newsItem.image ? (
{newsItem.title}
) : (
)}
{newsItem.category}
{newsItem.date}

{newsItem.title}

{newsItem.excerpt}

阅读更多
))}
{totalPages > 1 && (
{Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => ( ))}
)}
)}
); }