blob: 80e44eb75670fd4ff6a2897fe2e1279814ae91e4 [file] [log] [blame]
223010143d966302025-06-07 22:54:40 +08001import { NavLink } from 'react-router';
2import filmImg from '../../assets/categories/film.jpg';
3import musicImg from '../../assets/categories/music.jpg';
4import gameImg from '../../assets/categories/game.jpg';
5import otherImg from '../../assets/categories/other.jpg';
6// 假设你有排行榜数据,这里模拟一下,实际根据接口等替换
7const filmRankList = [
8 { id: 1, name: '影视作品1', view: '1.2万' },
9 { id: 2, name: '影视作品2', view: '1.1万' },
10 { id: 3, name: '影视作品3', view: '1.0万' },
11];
12const musicRankList = [
13 { id: 1, name: '音乐作品1', view: '1.5万' },
14 { id: 2, name: '音乐作品2', view: '1.3万' },
15 { id: 3, name: '音乐作品3', view: '1.2万' },
16];
17const gameRankList = [
18 { id: 1, name: '游戏作品1', view: '2.0万' },
19 { id: 2, name: '游戏作品2', view: '1.8万' },
20 { id: 3, name: '游戏作品3', view: '1.6万' },
21];
22const otherRankList = [
23 { id: 1, name: '其他作品1', view: '0.8万' },
24 { id: 2, name: '其他作品2', view: '0.7万' },
25 { id: 3, name: '其他作品3', view: '0.6万' },
26];
27
22301014bc4616f2025-06-03 16:59:44 +080028function Home() {
223010143d966302025-06-07 22:54:40 +080029 const categories = [
30 { id: 'film', name: '影视', image: filmImg, rankList: filmRankList },
31 { id: 'music', name: '音乐', image: musicImg, rankList: musicRankList },
32 { id: 'game', name: '游戏', image: gameImg, rankList: gameRankList },
33 { id: 'other', name: '其他', image: otherImg, rankList: otherRankList },
34 ];
22301014bc4616f2025-06-03 16:59:44 +080035
36 return (
223010143d966302025-06-07 22:54:40 +080037 <div className="max-w-7xl mx-auto px-4 py-16 flex flex-col items-center">
38 {/* 页面标题 */}
39 <h1 className="text-[clamp(2rem,5vw,3.5rem)] font-bold text-center mb-12 text-gray-800 tracking-tight">
40 欢迎访问创意协作平台
41 </h1>
42
43 {/* 分区 + 排行榜 容器,改为 flex 布局 */}
44 <div className="w-full flex max-w-6xl mx-auto">
45 {/* 分区卡片容器 - 响应式网格布局 */}
46 <div className="grid grid-cols-4 gap-6 w-3/4">
47 {categories.map((category) => (
48 <div
49 key={category.id}
50 className="group relative overflow-hidden rounded-xl shadow-lg transition-all duration-300 hover:-translate-y-2 hover:shadow-xl"
51 >
52 <NavLink to={`/categories/${category.id}`} className="block">
53 {/* 图片容器 */}
54 <div className="aspect-[4/3] relative overflow-hidden">
55 {/* 背景图片 - 带模糊和亮度调整 */}
56 <img
57 src={category.image}
58 alt={category.name}
59 className="w-full h-full object-cover transition-transform duration-700 group-hover:scale-110"
60 style={{ filter: 'blur(1px) brightness(0.85)' }}
61 />
62
63 {/* 渐变遮罩层 - 增强文字可读性 */}
64 <div className="absolute inset-0 bg-gradient-to-t from-black/80 via-black/40 to-transparent z-10"></div>
65
66 {/* 文字内容 */}
67 <div className="absolute inset-0 flex flex-col items-center justify-center p-4 z-20">
68 {/* 分类标题 - 艺术字体 */}
69 <h2 className="text-[clamp(1.8rem,4vw,2.5rem)] font-bold text-white text-center mb-2" style={{
70 fontFamily: '"Playfair Display", serif',
71 textShadow: '0 4px 12px rgba(0,0,0,0.8)',
72 transform: 'translateY(10px)',
73 transition: 'transform 0.3s ease-out',
74 letterSpacing: '2px',
75 borderBottom: '2px solid rgba(255,255,255,0.6)',
76 paddingBottom: '4px'
77 }}>
78 {category.name}
79 </h2>
80
81 {/* 描述文本 - 悬停显示 */}
82 <p className="text-indigo-100 text-center opacity-0 transform translate-y-4 transition-all duration-300 group-hover:opacity-100 group-hover:translate-y-0 mt-2" style={{
83 fontFamily: '"Merriweather", serif',
84 textShadow: '0 2px 6px rgba(0,0,0,0.6)'
85 }}>
86 探索{category.name}创意项目
87 </p>
88 </div>
89 </div>
90 </NavLink>
91 </div>
92 ))}
93 </div>
94
95 {/* 排行榜区域 - 右侧 */}
96 <div className="w-1/4 pl-6">
97 {categories.map((category) => (
98 <div key={category.id} className="mb-8">
99 <h3 className="text-xl font-bold text-gray-800 mb-4">{category.name}排行榜</h3>
100 <ul>
101 {category.rankList.map((item) => (
102 <li key={item.id} className="flex justify-between items-center mb-2">
103 <span>{item.name}</span>
104 <span className="text-gray-600">{item.view}</span>
105 </li>
106 ))}
107 </ul>
108 </div>
109 ))}
110 </div>
111 </div>
112 </div>
113 );
22301014bc4616f2025-06-03 16:59:44 +0800114}
115
223010143d966302025-06-07 22:54:40 +0800116export default Home;