feat(cms): 添加 CMS 内容管理系统与 Admin 管理后台

- 新增 Prisma + SQLite 数据库模型 (Category, Content, Media, User 等)
- 新增 Admin 管理后台 (认证、内容管理、媒体管理)
- 新增 CMS API 路由 (CRUD, 草稿/发布, 重新验证)
- 新增 CMS 内容版本的历史归档页面
- 新增 components/cms 内容渲染组件
- 新增 components/admin 管理后台 UI 组件
- 更新 Contact API 路由
This commit is contained in:
张翔
2026-07-07 06:53:58 +08:00
parent 829d83522c
commit b5245f9aa2
87 changed files with 25659 additions and 0 deletions
@@ -0,0 +1,183 @@
'use client';
import { useState, useMemo, useEffect } from 'react';
import { initCms, getItemRenderer } from '@/lib/cms';
import type { ContentItem } from '@/lib/cms';
import { NEWS } from '@/lib/constants';
const categories = ['全部', '公司新闻', '研发动态'];
const ITEMS_PER_PAGE = 9;
function newsToContentItem(news: unknown, index: number): ContentItem {
const n = news as Record<string, unknown>;
return {
id: String(n.id),
modelId: 'news',
modelCode: 'news',
title: String(n.title),
slug: String(n.id),
status: 'published',
version: 1,
sortOrder: index,
data: n,
createdAt: '2024-01-01T00:00:00Z',
updatedAt: '2024-01-01T00:00:00Z',
publishedAt: '2024-01-01T00:00:00Z',
createdBy: 'system',
updatedBy: 'system',
};
}
export default function NewsContentCms() {
const [ready, setReady] = useState(false);
const [items, setItems] = useState<ContentItem[]>([]);
const [selectedCategory, setSelectedCategory] = useState('全部');
const [searchQuery, setSearchQuery] = useState('');
const [currentPage, setCurrentPage] = useState(1);
useEffect(() => {
initCms();
setItems(NEWS.map(newsToContentItem));
setReady(true);
}, []);
const filteredItems = useMemo(() => {
return items.filter((item) => {
const data = item.data as Record<string, unknown>;
const category = (data.category as string) || '';
const matchesCategory = selectedCategory === '全部' || category === selectedCategory;
const matchesSearch =
!searchQuery ||
item.title.toLowerCase().includes(searchQuery.toLowerCase()) ||
((data.excerpt as string) || '').toLowerCase().includes(searchQuery.toLowerCase());
return matchesCategory && matchesSearch;
});
}, [items, selectedCategory, searchQuery]);
const totalPages = Math.ceil(filteredItems.length / ITEMS_PER_PAGE);
const paginatedItems = filteredItems.slice(
(currentPage - 1) * ITEMS_PER_PAGE,
currentPage * ITEMS_PER_PAGE
);
useEffect(() => {
setCurrentPage(1);
}, [selectedCategory, searchQuery]);
if (!ready) {
return (
<div className="min-h-screen bg-ink flex items-center justify-center">
<div className="text-white/50">加载中...</div>
</div>
);
}
const NewsCardRenderer = getItemRenderer('news');
return (
<div className="min-h-screen bg-ink text-white overflow-x-hidden" data-theme="dark">
<section className="relative min-h-[50vh] flex items-center overflow-hidden bg-ink pt-24">
<div className="absolute inset-0">
<div className="absolute top-1/4 -left-32 w-96 h-96 rounded-full bg-brand/20 blur-[120px]" />
</div>
<div className="relative z-10 w-full max-w-7xl mx-auto px-6 lg:px-8 py-20">
<div className="inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/[0.05] border border-white/[0.1] text-sm text-white/70 mb-6">
<span className="w-1.5 h-1.5 rounded-full bg-brand animate-pulse" />
新闻动态
</div>
<h1 className="text-4xl sm:text-5xl md:text-6xl font-bold text-white tracking-tight leading-[1.1]">
最新动态
</h1>
<p className="mt-6 text-lg text-white/60 max-w-2xl leading-relaxed">
了解公司最新动态、行业洞察和技术分享,与我们一起成长。
</p>
</div>
</section>
<section className="relative py-16 sm:py-20 md:py-28 overflow-hidden bg-ink-light">
<div className="max-w-7xl mx-auto px-6 lg:px-8">
<div className="flex flex-col md:flex-row md:items-center md:justify-between gap-6 mb-12">
<div className="flex flex-wrap gap-2">
{categories.map((cat) => (
<button
key={cat}
onClick={() => setSelectedCategory(cat)}
className={`px-5 py-2 text-sm font-medium rounded-xl transition-all ${
selectedCategory === cat
? 'bg-brand text-white'
: 'bg-white/[0.05] text-white/60 hover:bg-white/[0.1] hover:text-white border border-white/[0.08]'
}`}
>
{cat}
</button>
))}
</div>
<div className="relative w-full md:w-80">
<input
type="text"
placeholder="搜索新闻..."
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
className="w-full pl-10 pr-4 py-2.5 bg-white/[0.05] border border-white/[0.1] rounded-xl text-white text-sm placeholder-white/30 focus:outline-none focus:border-brand/50 focus:ring-1 focus:ring-brand/30 transition-colors"
/>
<svg className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-white/40" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
</svg>
</div>
</div>
{paginatedItems.length > 0 ? (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 md:gap-8">
{paginatedItems.map((item, i) =>
NewsCardRenderer ? (
<NewsCardRenderer key={item.id} item={item} index={i} variant="featured" />
) : (
<div key={item.id} className="p-4 border border-white/10 rounded-lg">
{item.title}
</div>
)
)}
</div>
) : (
<div className="py-20 text-center">
<div className="text-5xl mb-4 opacity-30">📭</div>
<div className="text-white/50">暂无相关新闻</div>
</div>
)}
{totalPages > 1 && (
<div className="mt-16 flex items-center justify-center gap-2">
<button
onClick={() => setCurrentPage((p) => Math.max(1, p - 1))}
disabled={currentPage === 1}
className="p-2 rounded-lg bg-white/[0.05] text-white/60 hover:bg-white/[0.1] disabled:opacity-30 disabled:cursor-not-allowed transition-colors"
>
←
</button>
{Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => (
<button
key={page}
onClick={() => setCurrentPage(page)}
className={`w-10 h-10 rounded-lg text-sm font-medium transition-colors ${
currentPage === page
? 'bg-brand text-white'
: 'bg-white/[0.05] text-white/60 hover:bg-white/[0.1]'
}`}
>
{page}
</button>
))}
<button
onClick={() => setCurrentPage((p) => Math.min(totalPages, p + 1))}
disabled={currentPage === totalPages}
className="p-2 rounded-lg bg-white/[0.05] text-white/60 hover:bg-white/[0.1] disabled:opacity-30 disabled:cursor-not-allowed transition-colors"
>
→
</button>
</div>
)}
</div>
</section>
</div>
);
}
@@ -0,0 +1,297 @@
'use client';
import { useState, useMemo, ChangeEvent } from 'react';
import { motion } from 'framer-motion';
import { ScrollReveal, StaggerReveal } from '@/components/ui/scroll-reveal';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import { Input } from '@/components/ui/input';
import { Search, Calendar, ArrowRight, Newspaper, ChevronLeft, ChevronRight } from 'lucide-react';
import { NEWS, COMPANY_INFO } from '@/lib/constants';
import { cn } from '@/lib/utils';
const EASE_OUT = [0.22, 1, 0.36, 1] as const;
const categories = ['全部', '公司新闻', '研发动态'];
const ITEMS_PER_PAGE = 9;
function GrainOverlay() {
return (
<div
className="absolute inset-0 pointer-events-none opacity-[0.03] mix-blend-overlay"
style={{
backgroundImage:
"url(\"data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E\")",
}}
/>
);
}
function SectionLabel({ children, className = '' }: { children: React.ReactNode; className?: string }) {
return (
<div className={cn('flex items-center gap-5 mb-7', className)}>
<div className="w-14 h-px bg-brand" />
<span className="text-[11px] tracking-[0.4em] uppercase font-bold text-brand">
{children}
</span>
<div className="w-14 h-px bg-brand" />
</div>
);
}
function NewsCard({ newsItem, index }: { newsItem: typeof NEWS[0]; index: number }) {
return (
<motion.div
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{ duration: 0.5, delay: index * 0.08, ease: EASE_OUT }}
>
<a
href={`/news/${newsItem.id}`}
className="group relative block border border-white/10 hover:border-brand/40 bg-ink transition-all duration-600 hover:-translate-y-2 overflow-hidden h-full"
>
<div className="absolute top-0 left-0 right-0 h-1 bg-brand scale-x-0 group-hover:scale-x-100 transition-transform duration-700 origin-left" />
{newsItem.image ? (
<div className="aspect-video bg-ink-light overflow-hidden">
<img
src={newsItem.image}
alt={newsItem.title}
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-700"
/>
</div>
) : (
<div className="aspect-video bg-gradient-to-br from-brand/10 to-ink-light flex items-center justify-center">
<Newspaper className="w-12 h-12 text-brand/30" />
</div>
)}
<div className="p-6 lg:p-8">
<div className="flex items-center gap-3 mb-4">
<Badge variant="outline" className="text-xs border-brand/30 text-brand">
{newsItem.category}
</Badge>
<div className="flex items-center gap-1.5 text-xs text-white/50">
<Calendar className="w-3.5 h-3.5" />
{newsItem.date}
</div>
</div>
<h3 className="text-lg font-semibold text-white mb-3 line-clamp-2 group-hover:text-brand transition-colors duration-300 leading-snug">
{newsItem.title}
</h3>
<p className="text-sm text-white/50 line-clamp-3 mb-5 leading-relaxed">
{newsItem.excerpt}
</p>
<div className="flex items-center text-brand text-sm font-medium">
阅读全文
<ArrowRight className="ml-2 w-4 h-4 group-hover:translate-x-1 transition-transform duration-300" />
</div>
</div>
</a>
</motion.div>
);
}
export default function NewsContentV1() {
const [selectedCategory, setSelectedCategory] = useState('全部');
const [searchQuery, setSearchQuery] = useState('');
const [currentPage, setCurrentPage] = useState(1);
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<HTMLInputElement>) => {
setSearchQuery(e.target.value);
setCurrentPage(1);
};
return (
<div className="min-h-screen bg-ink text-white overflow-x-hidden">
{/* Hero Section */}
<section className="relative pt-32 pb-24 lg:pt-40 lg:pb-32 overflow-hidden">
<GrainOverlay />
<div className="absolute inset-0 bg-gradient-to-b from-ink-light/50 to-ink pointer-events-none" />
<div className="max-w-container mx-auto px-6 lg:px-10 relative z-10">
<ScrollReveal>
<SectionLabel>News & Insights</SectionLabel>
</ScrollReveal>
<ScrollReveal delay={0.1}>
<h1 className="mt-8 text-4xl md:text-5xl lg:text-6xl xl:text-7xl font-bold tracking-tight leading-[1.1]">
新闻与
<span className="block mt-2 text-brand">洞察</span>
</h1>
</ScrollReveal>
<ScrollReveal delay={0.2}>
<p className="mt-8 text-lg md:text-xl text-white/60 max-w-2xl leading-relaxed">
{COMPANY_INFO.displayName}最新动态、产品更新与行业洞察。了解数字化趋势,把握技术脉搏。
</p>
</ScrollReveal>
</div>
</section>
{/* Filter + News List Section */}
<section className="relative py-24 lg:py-32 overflow-hidden bg-ink-light">
<GrainOverlay />
<div className="absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-white/12 to-transparent" />
<div className="max-w-container mx-auto px-6 lg:px-10 relative z-10">
{/* Filters */}
<ScrollReveal className="mb-16 space-y-6">
<div className="flex flex-wrap gap-3">
{categories.map((category) => (
<Button
key={category}
variant={selectedCategory === category ? 'primary' : 'outline'}
onClick={() => handleCategoryChange(category)}
>
{category}
</Button>
))}
</div>
<div className="relative max-w-md">
<Search className="absolute left-4 top-1/2 transform -translate-y-1/2 text-white/40 w-5 h-5 pointer-events-none" />
<Input
type="text"
placeholder="搜索新闻..."
value={searchQuery}
onChange={handleSearchChange}
className="pl-12 h-12 bg-ink border-white/10 text-white placeholder:text-white/30 focus:border-brand/50"
/>
</div>
</ScrollReveal>
{/* News Grid */}
{paginatedNews.length === 0 ? (
<ScrollReveal>
<div className="text-center py-24">
<Newspaper className="w-16 h-16 text-white/20 mx-auto mb-6" />
<p className="text-xl text-white/50">没有找到相关新闻</p>
<p className="mt-2 text-white/30">试试其他关键词或分类</p>
</div>
</ScrollReveal>
) : (
<>
<StaggerReveal
className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 md:gap-8"
delayChildren={0.05}
>
{paginatedNews.map((newsItem, index) => (
<NewsCard key={newsItem.id} newsItem={newsItem} index={index} />
))}
</StaggerReveal>
{/* Pagination */}
{totalPages > 1 && (
<ScrollReveal>
<div className="flex justify-center items-center gap-2 mt-16">
<Button
variant="outline"
size="icon"
onClick={() => handlePageChange(currentPage - 1)}
disabled={currentPage === 1}
>
<ChevronLeft className="w-4 h-4" />
</Button>
{Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => (
<Button
key={page}
variant={currentPage === page ? 'primary' : 'outline'}
size="icon"
onClick={() => handlePageChange(page)}
>
{page}
</Button>
))}
<Button
variant="outline"
size="icon"
onClick={() => handlePageChange(currentPage + 1)}
disabled={currentPage === totalPages}
>
<ChevronRight className="w-4 h-4" />
</Button>
</div>
</ScrollReveal>
)}
</>
)}
</div>
</section>
{/* CTA Section */}
<section className="relative py-36 lg:py-44 overflow-hidden bg-ink">
<GrainOverlay />
<div className="absolute inset-0 pointer-events-none">
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px] rounded-full opacity-[0.08] blur-3xl bg-brand" />
</div>
<div className="max-w-container mx-auto px-6 lg:px-10 relative z-10">
<ScrollReveal className="max-w-3xl mx-auto text-center">
<SectionLabel className="justify-center">
<div className="flex items-center gap-5">
<div className="w-14 h-px bg-brand" />
<span className="text-[11px] tracking-[0.4em] uppercase font-bold text-brand">
Get in Touch
</span>
<div className="w-14 h-px bg-brand" />
</div>
</SectionLabel>
<h2 className="text-3xl md:text-4xl lg:text-6xl font-bold text-white tracking-tight leading-tight mb-8">
想了解更多?
</h2>
<p className="text-lg md:text-xl text-white/60 leading-relaxed mb-12">
无论您有合作意向还是想探讨技术趋势,我们都欢迎与您交流。
</p>
<div className="flex flex-wrap gap-6 justify-center">
<Button size="xl" asChild>
<a href="/contact">
联系我们
<ArrowRight className="w-5 h-5 ml-2" />
</a>
</Button>
<Button size="xl" variant="outline" asChild>
<a href="/about">了解公司</a>
</Button>
</div>
</ScrollReveal>
</div>
</section>
</div>
);
}
@@ -0,0 +1,268 @@
'use client';
import { useState, useMemo, ChangeEvent } from 'react';
import { motion } from 'framer-motion';
import { ScrollReveal, StaggerReveal } from '@/components/ui/scroll-reveal';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import { Input } from '@/components/ui/input';
import { Search, Calendar, ArrowRight, Newspaper, ChevronLeft, ChevronRight } from 'lucide-react';
import { COMPANY_INFO } from '@/lib/constants';
import { type NewsItem } from '@/lib/constants/news';
import { getMockItems } from '@/lib/cms/mock-data';
// CMS 数据源:优先使用 prop,回退到 mock-data
function getNewsData(newsProp?: NewsItem[]): NewsItem[] {
if (newsProp?.length) return newsProp;
return getMockItems('news').map(
(item) => ({ ...item.data, title: item.data.title || item.title } as unknown as NewsItem),
);
}
import { SectionLabel, EASE_OUT } from '@/components/ui/page-decoration';
const categories = ['全部', '公司新闻', '研发动态'];
const ITEMS_PER_PAGE = 9;
function NewsCard({ newsItem, index }: { newsItem: NewsItem; index: number }) {
return (
<motion.div
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, margin: '-80px' }}
transition={{ duration: 0.5, delay: index * 0.08, ease: EASE_OUT }}
>
<a
href={`/news/${newsItem.id}`}
className="group relative block border border-border-primary hover:border-brand/30 bg-white transition-all duration-500 hover:-translate-y-2 overflow-hidden h-full"
>
<div className="absolute top-0 left-0 bottom-0 w-1 bg-brand scale-y-0 group-hover:scale-y-100 transition-transform duration-500 origin-top" />
{newsItem.image ? (
<div className="aspect-video bg-bg-secondary overflow-hidden">
<img
src={newsItem.image}
alt={newsItem.title}
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-700"
/>
</div>
) : (
<div className="aspect-video bg-gradient-to-br from-brand/[0.08] to-bg-secondary flex items-center justify-center">
<Newspaper className="w-12 h-12 text-brand/30" />
</div>
)}
<div className="p-6 sm:p-7 lg:p-8">
<div className="flex items-center gap-3 mb-4">
<Badge variant="outline" className="text-xs border-brand/30 text-brand">
{newsItem.category}
</Badge>
<div className="flex items-center gap-1.5 text-xs text-text-muted">
<Calendar className="w-3.5 h-3.5" />
{newsItem.date}
</div>
</div>
<h3 className="text-lg sm:text-xl font-semibold text-ink mb-3 line-clamp-2 group-hover:text-brand transition-colors duration-300 leading-snug">
{newsItem.title}
</h3>
<p className="text-sm text-text-secondary line-clamp-3 mb-5 leading-relaxed">
{newsItem.excerpt}
</p>
<div className="flex items-center text-brand text-sm font-medium">
阅读全文
<ArrowRight className="ml-2 w-4 h-4 group-hover:translate-x-1 transition-transform duration-300" />
</div>
</div>
</a>
</motion.div>
);
}
export default function NewsContentV2({ news }: { news?: NewsItem[] }) {
const NEWS = getNewsData(news);
const [selectedCategory, setSelectedCategory] = useState('全部');
const [searchQuery, setSearchQuery] = useState('');
const [currentPage, setCurrentPage] = useState(1);
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<HTMLInputElement>) => {
setSearchQuery(e.target.value);
setCurrentPage(1);
};
return (
<div className="min-h-screen bg-white text-ink overflow-x-hidden">
{/* Hero Section */}
<section className="relative min-h-[75vh] flex items-center overflow-hidden bg-white">
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10 w-full py-28 sm:py-36 md:py-44 lg:py-56">
<div className="max-w-4xl">
<ScrollReveal>
<SectionLabel>News &amp; Insights</SectionLabel>
</ScrollReveal>
<ScrollReveal delay={0.1}>
<h1 className="text-4xl sm:text-5xl md:text-6xl lg:text-7xl xl:text-8xl font-bold leading-[0.92] tracking-tighter mb-10 sm:mb-12 md:mb-16">
新闻与
<span className="block mt-4 text-brand">洞察</span>
</h1>
</ScrollReveal>
<ScrollReveal delay={0.2}>
<p className="text-lg md:text-xl text-text-secondary max-w-2xl leading-relaxed">
{COMPANY_INFO.displayName}最新动态、产品更新与行业洞察。了解数字化趋势,把握技术脉搏。
</p>
</ScrollReveal>
</div>
</div>
</section>
{/* Filter + News List Section */}
<section className="relative py-20 sm:py-28 md:py-36 lg:py-44 overflow-hidden bg-bg-secondary">
<div className="absolute top-0 left-0 right-0 h-px bg-border-primary" />
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10">
{/* Filters */}
<ScrollReveal className="mb-12 sm:mb-16 space-y-6">
<div className="flex flex-wrap gap-3">
{categories.map((category) => (
<Button
key={category}
variant={selectedCategory === category ? 'primary' : 'outline'}
onClick={() => handleCategoryChange(category)}
>
{category}
</Button>
))}
</div>
<div className="relative max-w-md">
<Search className="absolute left-4 top-1/2 transform -translate-y-1/2 text-text-muted w-5 h-5 pointer-events-none" />
<Input
type="text"
placeholder="搜索新闻..."
value={searchQuery}
onChange={handleSearchChange}
className="pl-12 h-12 bg-white border-border-primary text-ink placeholder:text-text-muted focus:border-brand/50"
/>
</div>
</ScrollReveal>
{/* News Grid */}
{paginatedNews.length === 0 ? (
<ScrollReveal>
<div className="text-center py-24">
<Newspaper className="w-16 h-16 text-text-muted/20 mx-auto mb-6" />
<p className="text-xl text-text-secondary">没有找到相关新闻</p>
<p className="mt-2 text-text-muted">试试其他关键词或分类</p>
</div>
</ScrollReveal>
) : (
<>
<StaggerReveal
className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 sm:gap-8"
delayChildren={0.05}
>
{paginatedNews.map((newsItem, index) => (
<NewsCard key={newsItem.id} newsItem={newsItem} index={index} />
))}
</StaggerReveal>
{/* Pagination */}
{totalPages > 1 && (
<ScrollReveal>
<div className="flex justify-center items-center gap-2 mt-16">
<Button
variant="outline"
size="icon"
onClick={() => handlePageChange(currentPage - 1)}
disabled={currentPage === 1}
>
<ChevronLeft className="w-4 h-4" />
</Button>
{Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => (
<Button
key={page}
variant={currentPage === page ? 'primary' : 'outline'}
size="icon"
onClick={() => handlePageChange(page)}
>
{page}
</Button>
))}
<Button
variant="outline"
size="icon"
onClick={() => handlePageChange(currentPage + 1)}
disabled={currentPage === totalPages}
>
<ChevronRight className="w-4 h-4" />
</Button>
</div>
</ScrollReveal>
)}
</>
)}
</div>
</section>
{/* CTA Section */}
<section className="relative py-20 sm:py-28 md:py-36 lg:py-44 overflow-hidden bg-white">
<div className="absolute top-0 left-0 right-0 h-px bg-border-primary" />
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10">
<ScrollReveal className="text-center max-w-3xl mx-auto">
<SectionLabel className="justify-center">Get in Touch</SectionLabel>
<h2 className="text-3xl sm:text-4xl md:text-5xl font-bold tracking-tight leading-tight">
想了解更多?
</h2>
<p className="mt-6 text-lg text-text-secondary leading-relaxed">
无论您有合作意向还是想探讨技术趋势,我们都欢迎与您交流。
</p>
<div className="mt-12 flex flex-col sm:flex-row justify-center gap-4 sm:gap-6">
<a
href="/contact"
className="group inline-flex items-center justify-center gap-3 px-12 py-6 font-semibold text-base bg-brand text-white transition-all duration-300 hover:bg-brand/90"
>
联系我们
<ArrowRight className="w-4 h-4 transition-transform duration-300 group-hover:translate-x-1" />
</a>
<a
href="/about"
className="inline-flex items-center justify-center gap-3 px-12 py-6 font-semibold text-base text-ink border border-border-primary hover:border-border-secondary hover:bg-bg-secondary transition-all duration-300"
>
了解公司
</a>
</div>
</ScrollReveal>
</div>
</section>
</div>
);
}
@@ -0,0 +1,259 @@
'use client';
import { useState, useMemo, ChangeEvent } from 'react';
import { motion } from 'framer-motion';
import { ScrollReveal, StaggerReveal } from '@/components/ui/scroll-reveal';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import { Input } from '@/components/ui/input';
import { Search, Calendar, ArrowRight, Newspaper, ChevronLeft, ChevronRight } from 'lucide-react';
import { COMPANY_INFO } from '@/lib/constants';
import { type NewsItem } from '@/lib/constants/news';
import { SectionLabel, EASE_OUT } from '@/components/ui/page-decoration';
const categories = ['全部', '公司新闻', '研发动态'];
const ITEMS_PER_PAGE = 9;
function NewsCard({ newsItem, index }: { newsItem: NewsItem; index: number }) {
return (
<motion.div
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, margin: '-80px' }}
transition={{ duration: 0.5, delay: index * 0.08, ease: EASE_OUT }}
>
<a
href={`/news/${newsItem.id}`}
className="group relative block border border-border-primary hover:border-brand/30 bg-white transition-all duration-500 hover:-translate-y-2 overflow-hidden h-full"
>
<div className="absolute top-0 left-0 bottom-0 w-1 bg-brand scale-y-0 group-hover:scale-y-100 transition-transform duration-500 origin-top" />
{newsItem.image ? (
<div className="aspect-video bg-bg-secondary overflow-hidden">
<img
src={newsItem.image}
alt={newsItem.title}
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-700"
/>
</div>
) : (
<div className="aspect-video bg-gradient-to-br from-brand/[0.08] to-bg-secondary flex items-center justify-center">
<Newspaper className="w-12 h-12 text-brand/30" />
</div>
)}
<div className="p-6 sm:p-7 lg:p-8">
<div className="flex items-center gap-3 mb-4">
<Badge variant="outline" className="text-xs border-brand/30 text-brand">
{newsItem.category}
</Badge>
<div className="flex items-center gap-1.5 text-xs text-text-muted">
<Calendar className="w-3.5 h-3.5" />
{newsItem.date}
</div>
</div>
<h3 className="text-lg sm:text-xl font-semibold text-ink mb-3 line-clamp-2 group-hover:text-brand transition-colors duration-300 leading-snug">
{newsItem.title}
</h3>
<p className="text-sm text-text-secondary line-clamp-3 mb-5 leading-relaxed">
{newsItem.excerpt}
</p>
<div className="flex items-center text-brand text-sm font-medium">
阅读全文
<ArrowRight className="ml-2 w-4 h-4 group-hover:translate-x-1 transition-transform duration-300" />
</div>
</div>
</a>
</motion.div>
);
}
export default function NewsContentV3({ news }: { news?: NewsItem[] }) {
const NEWS = news ?? [];
const [selectedCategory, setSelectedCategory] = useState('全部');
const [searchQuery, setSearchQuery] = useState('');
const [currentPage, setCurrentPage] = useState(1);
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<HTMLInputElement>) => {
setSearchQuery(e.target.value);
setCurrentPage(1);
};
return (
<div className="min-h-screen bg-white text-ink overflow-x-hidden">
{/* Hero Section */}
<section className="relative min-h-[75vh] flex items-center overflow-hidden bg-white">
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10 w-full py-28 sm:py-36 md:py-44 lg:py-56">
<div className="max-w-4xl">
<ScrollReveal>
<SectionLabel>News &amp; Insights</SectionLabel>
</ScrollReveal>
<ScrollReveal delay={0.1}>
<h1 className="text-4xl sm:text-5xl md:text-6xl lg:text-7xl xl:text-8xl font-bold leading-[0.92] tracking-tighter mb-10 sm:mb-12 md:mb-16">
新闻与
<span className="block mt-4 text-brand">洞察</span>
</h1>
</ScrollReveal>
<ScrollReveal delay={0.2}>
<p className="text-lg md:text-xl text-text-secondary max-w-2xl leading-relaxed">
{COMPANY_INFO.displayName}最新动态、产品更新与行业洞察。了解数字化趋势,把握技术脉搏。
</p>
</ScrollReveal>
</div>
</div>
</section>
{/* Filter + News List Section */}
<section className="relative py-20 sm:py-28 md:py-36 lg:py-44 overflow-hidden bg-bg-secondary">
<div className="absolute top-0 left-0 right-0 h-px bg-border-primary" />
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10">
{/* Filters */}
<ScrollReveal className="mb-12 sm:mb-16 space-y-6">
<div className="flex flex-wrap gap-3">
{categories.map((category) => (
<Button
key={category}
variant={selectedCategory === category ? 'primary' : 'outline'}
onClick={() => handleCategoryChange(category)}
>
{category}
</Button>
))}
</div>
<div className="relative max-w-md">
<Search className="absolute left-4 top-1/2 transform -translate-y-1/2 text-text-muted w-5 h-5 pointer-events-none" />
<Input
type="text"
placeholder="搜索新闻..."
value={searchQuery}
onChange={handleSearchChange}
className="pl-12 h-12 bg-white border-border-primary text-ink placeholder:text-text-muted focus:border-brand/50"
/>
</div>
</ScrollReveal>
{/* News Grid */}
{paginatedNews.length === 0 ? (
<ScrollReveal>
<div className="text-center py-24">
<Newspaper className="w-16 h-16 text-text-muted/20 mx-auto mb-6" />
<p className="text-xl text-text-secondary">没有找到相关新闻</p>
<p className="mt-2 text-text-muted">试试其他关键词或分类</p>
</div>
</ScrollReveal>
) : (
<>
<StaggerReveal
className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 sm:gap-8"
delayChildren={0.05}
>
{paginatedNews.map((newsItem, index) => (
<NewsCard key={newsItem.id} newsItem={newsItem} index={index} />
))}
</StaggerReveal>
{/* Pagination */}
{totalPages > 1 && (
<ScrollReveal>
<div className="flex justify-center items-center gap-2 mt-16">
<Button
variant="outline"
size="icon"
onClick={() => handlePageChange(currentPage - 1)}
disabled={currentPage === 1}
>
<ChevronLeft className="w-4 h-4" />
</Button>
{Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => (
<Button
key={page}
variant={currentPage === page ? 'primary' : 'outline'}
size="icon"
onClick={() => handlePageChange(page)}
>
{page}
</Button>
))}
<Button
variant="outline"
size="icon"
onClick={() => handlePageChange(currentPage + 1)}
disabled={currentPage === totalPages}
>
<ChevronRight className="w-4 h-4" />
</Button>
</div>
</ScrollReveal>
)}
</>
)}
</div>
</section>
{/* CTA Section */}
<section className="relative py-20 sm:py-28 md:py-36 lg:py-44 overflow-hidden bg-white">
<div className="absolute top-0 left-0 right-0 h-px bg-border-primary" />
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10">
<ScrollReveal className="text-center max-w-3xl mx-auto">
<SectionLabel className="justify-center">Get in Touch</SectionLabel>
<h2 className="text-3xl sm:text-4xl md:text-5xl font-bold tracking-tight leading-tight">
想了解更多?
</h2>
<p className="mt-6 text-lg text-text-secondary leading-relaxed">
无论您有合作意向还是想探讨技术趋势,我们都欢迎与您交流。
</p>
<div className="mt-12 flex flex-col sm:flex-row justify-center gap-4 sm:gap-6">
<a
href="/contact"
className="group inline-flex items-center justify-center gap-3 px-12 py-6 font-semibold text-base bg-brand text-white transition-all duration-300 hover:bg-brand/90"
>
联系我们
<ArrowRight className="w-4 h-4 transition-transform duration-300 group-hover:translate-x-1" />
</a>
<a
href="/about"
className="inline-flex items-center justify-center gap-3 px-12 py-6 font-semibold text-base text-ink border border-border-primary hover:border-border-secondary hover:bg-bg-secondary transition-all duration-300"
>
了解公司
</a>
</div>
</ScrollReveal>
</div>
</section>
</div>
);
}
@@ -0,0 +1,193 @@
'use client';
import { ScrollReveal } from '@/components/ui/scroll-reveal';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import { Calendar, ArrowLeft, Newspaper, ArrowRight } from 'lucide-react';
import { NEWS } from '@/lib/constants';
import { cn } from '@/lib/utils';
function GrainOverlay() {
return (
<div
className="absolute inset-0 pointer-events-none opacity-[0.03] mix-blend-overlay"
style={{
backgroundImage:
"url(\"data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E\")",
}}
/>
);
}
function SectionLabel({ children, className = '' }: { children: React.ReactNode; className?: string }) {
return (
<div className={cn('flex items-center gap-5 mb-7', className)}>
<div className="w-14 h-px bg-brand" />
<span className="text-[11px] tracking-[0.4em] uppercase font-bold text-brand">
{children}
</span>
<div className="w-14 h-px bg-brand" />
</div>
);
}
function RelatedNewsCard({ news }: { news: typeof NEWS[0] }) {
return (
<a
href={`/news/${news.id}`}
className="group relative block border border-white/10 hover:border-brand/40 bg-ink transition-all duration-600 hover:-translate-y-2 overflow-hidden h-full"
>
<div className="absolute top-0 left-0 right-0 h-1 bg-brand scale-x-0 group-hover:scale-x-100 transition-transform duration-700 origin-left" />
<div className="aspect-video bg-ink-light overflow-hidden">
{news.image ? (
<img
src={news.image}
alt={news.title}
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-700"
/>
) : (
<div className="w-full h-full bg-gradient-to-br from-brand/10 to-ink-light flex items-center justify-center">
<Newspaper className="w-10 h-10 text-brand/30" />
</div>
)}
</div>
<div className="p-5">
<Badge variant="outline" className="mb-3 text-xs border-brand/30 text-brand">
{news.category}
</Badge>
<h3 className="text-base font-semibold text-white mb-2 line-clamp-2 group-hover:text-brand transition-colors duration-300 leading-snug">
{news.title}
</h3>
<p className="text-sm text-white/50 line-clamp-2 leading-relaxed">{news.excerpt}</p>
</div>
</a>
);
}
interface NewsDetailContentV1Props {
news: typeof NEWS[0];
}
export default function NewsDetailContentV1({ news }: NewsDetailContentV1Props) {
const relatedNews = NEWS
.filter((n) => n.id !== news.id && n.category === news.category)
.slice(0, 3);
return (
<div className="min-h-screen bg-ink text-white overflow-x-hidden">
{/* Hero Section */}
<section className="relative pt-32 pb-16 lg:pt-40 lg:pb-20 overflow-hidden">
<GrainOverlay />
<div className="absolute inset-0 bg-gradient-to-b from-ink-light/50 to-ink pointer-events-none" />
<div className="max-w-container mx-auto px-6 lg:px-10 relative z-10">
<ScrollReveal>
<nav className="flex items-center gap-2 text-sm text-white/50 mb-10">
<a href="/news" className="hover:text-brand transition-colors duration-300">
新闻动态
</a>
<span>/</span>
<span className="text-white/80 line-clamp-1">{news.title}</span>
</nav>
</ScrollReveal>
<ScrollReveal delay={0.1} className="max-w-4xl">
<Badge variant="outline" className="mb-6 border-brand/30 text-brand text-sm">
{news.category}
</Badge>
<h1 className="text-3xl sm:text-4xl lg:text-5xl font-bold tracking-tight leading-tight">
{news.title}
</h1>
<div className="flex items-center gap-6 mt-8 text-white/50 text-sm">
<div className="flex items-center gap-2">
<Calendar className="w-4 h-4" />
{news.date}
</div>
</div>
<div className="mt-10 h-px bg-gradient-to-r from-brand/50 via-white/10 to-transparent" />
</ScrollReveal>
</div>
</section>
{/* Article Body Section */}
<section className="relative pb-24 lg:pb-32 overflow-hidden bg-ink">
<div className="max-w-container mx-auto px-6 lg:px-10">
<ScrollReveal className="max-w-4xl mx-auto">
{/* Featured Image */}
{news.image ? (
<div className="aspect-video overflow-hidden mb-12 border border-white/10">
<img
src={news.image}
alt={news.title}
className="w-full h-full object-cover"
/>
</div>
) : (
<div className="aspect-video bg-gradient-to-br from-brand/10 to-ink-light mb-12 flex items-center justify-center border border-white/10">
<Newspaper className="w-20 h-20 text-brand/20" />
</div>
)}
{/* Excerpt */}
<div className="mb-12 p-8 border-t-2 border-brand bg-brand/[0.04]">
<p className="text-lg text-white/80 leading-relaxed italic">
{news.excerpt}
</p>
</div>
{/* Article Content */}
<div className="prose prose-invert max-w-none">
<div className="text-white/80 text-base sm:text-lg leading-[1.9] whitespace-pre-line">
{news.content}
</div>
</div>
</ScrollReveal>
{/* Related News */}
{relatedNews.length > 0 && (
<div className="mt-24 pt-20 border-t border-white/10">
<ScrollReveal className="mb-16">
<SectionLabel>Related News</SectionLabel>
<h2 className="text-3xl md:text-4xl font-bold text-white tracking-tight leading-tight">
相关新闻
</h2>
</ScrollReveal>
<ScrollReveal delay={0.1}>
<div className="grid md:grid-cols-3 gap-6 md:gap-8">
{relatedNews.map((related) => (
<RelatedNewsCard key={related.id} news={related} />
))}
</div>
</ScrollReveal>
</div>
)}
{/* Navigation */}
<ScrollReveal>
<div className="mt-20 flex flex-wrap justify-center gap-4">
<Button size="lg" variant="outline" asChild>
<a href="/news">
<ArrowLeft className="w-4 h-4 mr-2" />
返回新闻列表
</a>
</Button>
<Button size="lg" asChild>
<a href="/contact">
联系我们
<ArrowRight className="w-4 h-4 ml-2" />
</a>
</Button>
</div>
</ScrollReveal>
</div>
</section>
</div>
);
}
@@ -0,0 +1,170 @@
'use client';
import { ScrollReveal } from '@/components/ui/scroll-reveal';
import { Badge } from '@/components/ui/badge';
import { Calendar, ArrowLeft, Newspaper, ArrowRight } from 'lucide-react';
import { NEWS } from '@/lib/constants';
import { SectionLabel, EASE_OUT } from '@/components/ui/page-decoration';
import { motion } from 'framer-motion';
function RelatedNewsCard({ news, index }: { news: typeof NEWS[0]; index: number }) {
return (
<motion.div
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, margin: '-80px' }}
transition={{ duration: 0.5, delay: index * 0.1, ease: EASE_OUT }}
>
<a
href={`/news/${news.id}`}
className="group relative block border border-border-primary hover:border-brand/30 bg-white transition-all duration-500 hover:-translate-y-2 overflow-hidden h-full"
>
<div className="absolute top-0 left-0 bottom-0 w-1 bg-brand scale-y-0 group-hover:scale-y-100 transition-transform duration-500 origin-top" />
<div className="aspect-video bg-bg-secondary overflow-hidden">
{news.image ? (
<img
src={news.image}
alt={news.title}
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-700"
/>
) : (
<div className="w-full h-full bg-gradient-to-br from-brand/[0.08] to-bg-secondary flex items-center justify-center">
<Newspaper className="w-10 h-10 text-brand/30" />
</div>
)}
</div>
<div className="p-5 sm:p-6">
<Badge variant="outline" className="mb-3 text-xs border-brand/30 text-brand">
{news.category}
</Badge>
<h3 className="text-base font-semibold text-ink mb-2 line-clamp-2 group-hover:text-brand transition-colors duration-300 leading-snug">
{news.title}
</h3>
<p className="text-sm text-text-secondary line-clamp-2 leading-relaxed">{news.excerpt}</p>
</div>
</a>
</motion.div>
);
}
interface NewsDetailContentV2Props {
news: typeof NEWS[0];
}
export default function NewsDetailContentV2({ news }: NewsDetailContentV2Props) {
const relatedNews = NEWS
.filter((n) => n.id !== news.id && n.category === news.category)
.slice(0, 3);
return (
<div className="min-h-screen bg-white text-ink overflow-x-hidden">
{/* Hero Section */}
<section className="relative pt-28 sm:pt-32 md:pt-40 pb-16 sm:pb-20 md:pb-24 overflow-hidden">
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10">
<ScrollReveal>
<nav className="flex items-center gap-2 text-sm text-text-muted mb-8 sm:mb-10">
<a href="/news" className="hover:text-brand transition-colors duration-300">
新闻动态
</a>
<span>/</span>
<span className="text-text-secondary line-clamp-1">{news.title}</span>
</nav>
</ScrollReveal>
<ScrollReveal delay={0.1} className="max-w-4xl">
<Badge variant="outline" className="mb-6 border-brand/30 text-brand text-sm">
{news.category}
</Badge>
<h1 className="text-3xl sm:text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight leading-tight">
{news.title}
</h1>
<div className="flex items-center gap-6 mt-8 text-text-muted text-sm">
<div className="flex items-center gap-2">
<Calendar className="w-4 h-4" />
{news.date}
</div>
</div>
<div className="mt-10 h-px bg-gradient-to-r from-brand/50 via-border-primary to-transparent" />
</ScrollReveal>
</div>
</section>
{/* Article Body Section */}
<section className="relative pb-20 sm:pb-28 md:pb-36 overflow-hidden bg-white">
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10">
<ScrollReveal className="max-w-4xl mx-auto">
{/* Featured Image */}
{news.image ? (
<div className="aspect-video overflow-hidden mb-10 sm:mb-12 border border-border-primary">
<img
src={news.image}
alt={news.title}
className="w-full h-full object-cover"
/>
</div>
) : (
<div className="aspect-video bg-gradient-to-br from-brand/[0.08] to-bg-secondary mb-10 sm:mb-12 flex items-center justify-center border border-border-primary">
<Newspaper className="w-20 h-20 text-brand/20" />
</div>
)}
{/* Excerpt */}
<div className="mb-10 sm:mb-12 p-6 sm:p-8 border-t-2 border-brand bg-brand/[0.04]">
<p className="text-base sm:text-lg text-text-secondary leading-relaxed italic">
{news.excerpt}
</p>
</div>
{/* Article Content */}
<div className="text-text-secondary text-base sm:text-lg leading-[1.9] whitespace-pre-line">
{news.content}
</div>
</ScrollReveal>
{/* Related News */}
{relatedNews.length > 0 && (
<div className="mt-20 sm:mt-24 pt-16 sm:pt-20 border-t border-border-primary">
<ScrollReveal className="mb-12 sm:mb-16">
<SectionLabel>Related News</SectionLabel>
<h2 className="text-2xl sm:text-3xl md:text-4xl font-bold tracking-tight leading-tight">
相关新闻
</h2>
</ScrollReveal>
<div className="grid md:grid-cols-3 gap-6 sm:gap-8">
{relatedNews.map((related, idx) => (
<RelatedNewsCard key={related.id} news={related} index={idx} />
))}
</div>
</div>
)}
{/* Navigation */}
<ScrollReveal>
<div className="mt-16 sm:mt-20 flex flex-col sm:flex-row justify-center gap-4">
<a
href="/news"
className="inline-flex items-center justify-center gap-2 px-8 py-4 font-medium text-base text-ink border border-border-primary hover:border-border-secondary hover:bg-bg-secondary transition-all duration-300"
>
<ArrowLeft className="w-4 h-4" />
返回新闻列表
</a>
<a
href="/contact"
className="group inline-flex items-center justify-center gap-2 px-8 py-4 font-medium text-base bg-brand text-white transition-all duration-300 hover:bg-brand/90"
>
联系我们
<ArrowRight className="w-4 h-4 transition-transform duration-300 group-hover:translate-x-1" />
</a>
</div>
</ScrollReveal>
</div>
</section>
</div>
);
}
@@ -0,0 +1,168 @@
'use client';
import { ScrollReveal } from '@/components/ui/scroll-reveal';
import { Badge } from '@/components/ui/badge';
import { Calendar, ArrowLeft, Newspaper, ArrowRight } from 'lucide-react';
import { SectionLabel, EASE_OUT } from '@/components/ui/page-decoration';
import { motion } from 'framer-motion';
import type { NewsItem } from '@/lib/constants/news';
function RelatedNewsCard({ news, index }: { news: NewsItem; index: number }) {
return (
<motion.div
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, margin: '-80px' }}
transition={{ duration: 0.5, delay: index * 0.1, ease: EASE_OUT }}
>
<a
href={`/news/${news.id}`}
className="group relative block border border-border-primary hover:border-brand/30 bg-white transition-all duration-500 hover:-translate-y-2 overflow-hidden h-full"
>
<div className="absolute top-0 left-0 bottom-0 w-1 bg-brand scale-y-0 group-hover:scale-y-100 transition-transform duration-500 origin-top" />
<div className="aspect-video bg-bg-secondary overflow-hidden">
{news.image ? (
<img
src={news.image}
alt={news.title}
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-700"
/>
) : (
<div className="w-full h-full bg-gradient-to-br from-brand/[0.08] to-bg-secondary flex items-center justify-center">
<Newspaper className="w-10 h-10 text-brand/30" />
</div>
)}
</div>
<div className="p-5 sm:p-6">
<Badge variant="outline" className="mb-3 text-xs border-brand/30 text-brand">
{news.category}
</Badge>
<h3 className="text-base font-semibold text-ink mb-2 line-clamp-2 group-hover:text-brand transition-colors duration-300 leading-snug">
{news.title}
</h3>
<p className="text-sm text-text-secondary line-clamp-2 leading-relaxed">{news.excerpt}</p>
</div>
</a>
</motion.div>
);
}
interface NewsDetailContentV3Props {
news: NewsItem;
relatedNews?: NewsItem[];
}
export default function NewsDetailContentV3({ news, relatedNews = [] }: NewsDetailContentV3Props) {
return (
<div className="min-h-screen bg-white text-ink overflow-x-hidden">
{/* Hero Section */}
<section className="relative pt-28 sm:pt-32 md:pt-40 pb-16 sm:pb-20 md:pb-24 overflow-hidden">
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10">
<ScrollReveal>
<nav className="flex items-center gap-2 text-sm text-text-muted mb-8 sm:mb-10">
<a href="/news" className="hover:text-brand transition-colors duration-300">
新闻动态
</a>
<span>/</span>
<span className="text-text-secondary line-clamp-1">{news.title}</span>
</nav>
</ScrollReveal>
<ScrollReveal delay={0.1} className="max-w-4xl">
<Badge variant="outline" className="mb-6 border-brand/30 text-brand text-sm">
{news.category}
</Badge>
<h1 className="text-3xl sm:text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight leading-tight">
{news.title}
</h1>
<div className="flex items-center gap-6 mt-8 text-text-muted text-sm">
<div className="flex items-center gap-2">
<Calendar className="w-4 h-4" />
{news.date}
</div>
</div>
<div className="mt-10 h-px bg-gradient-to-r from-brand/50 via-border-primary to-transparent" />
</ScrollReveal>
</div>
</section>
{/* Article Body Section */}
<section className="relative pb-20 sm:pb-28 md:pb-36 overflow-hidden bg-white">
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10">
<ScrollReveal className="max-w-4xl mx-auto">
{/* Featured Image */}
{news.image ? (
<div className="aspect-video overflow-hidden mb-10 sm:mb-12 border border-border-primary">
<img
src={news.image}
alt={news.title}
className="w-full h-full object-cover"
/>
</div>
) : (
<div className="aspect-video bg-gradient-to-br from-brand/[0.08] to-bg-secondary mb-10 sm:mb-12 flex items-center justify-center border border-border-primary">
<Newspaper className="w-20 h-20 text-brand/20" />
</div>
)}
{/* Excerpt */}
<div className="mb-10 sm:mb-12 p-6 sm:p-8 border-t-2 border-brand bg-brand/[0.04]">
<p className="text-base sm:text-lg text-text-secondary leading-relaxed italic">
{news.excerpt}
</p>
</div>
{/* Article Content */}
<div className="text-text-secondary text-base sm:text-lg leading-[1.9] whitespace-pre-line">
{news.content}
</div>
</ScrollReveal>
{/* Related News */}
{relatedNews.length > 0 && (
<div className="mt-20 sm:mt-24 pt-16 sm:pt-20 border-t border-border-primary">
<ScrollReveal className="mb-12 sm:mb-16">
<SectionLabel>Related News</SectionLabel>
<h2 className="text-2xl sm:text-3xl md:text-4xl font-bold tracking-tight leading-tight">
相关新闻
</h2>
</ScrollReveal>
<div className="grid md:grid-cols-3 gap-6 sm:gap-8">
{relatedNews.map((related, idx) => (
<RelatedNewsCard key={related.id} news={related} index={idx} />
))}
</div>
</div>
)}
{/* Navigation */}
<ScrollReveal>
<div className="mt-16 sm:mt-20 flex flex-col sm:flex-row justify-center gap-4">
<a
href="/news"
className="inline-flex items-center justify-center gap-2 px-8 py-4 font-medium text-base text-ink border border-border-primary hover:border-border-secondary hover:bg-bg-secondary transition-all duration-300"
>
<ArrowLeft className="w-4 h-4" />
返回新闻列表
</a>
<a
href="/contact"
className="group inline-flex items-center justify-center gap-2 px-8 py-4 font-medium text-base bg-brand text-white transition-all duration-300 hover:bg-brand/90"
>
联系我们
<ArrowRight className="w-4 h-4 transition-transform duration-300 group-hover:translate-x-1" />
</a>
</div>
</ScrollReveal>
</div>
</section>
</div>
);
}