2024-12-04 02:35:06 +08:00
|
|
|
|
import { Template } from "interface/template";
|
2024-12-12 23:27:36 +08:00
|
|
|
|
import {
|
|
|
|
|
Container,
|
|
|
|
|
Heading,
|
|
|
|
|
Text,
|
|
|
|
|
Flex,
|
|
|
|
|
Card,
|
|
|
|
|
Button,
|
|
|
|
|
ScrollArea,
|
|
|
|
|
} from "@radix-ui/themes";
|
2024-12-05 16:58:57 +08:00
|
|
|
|
import {
|
|
|
|
|
CalendarIcon,
|
|
|
|
|
ChevronLeftIcon,
|
|
|
|
|
ChevronRightIcon,
|
|
|
|
|
} from "@radix-ui/react-icons";
|
2024-12-12 23:27:36 +08:00
|
|
|
|
import { PostDisplay } from "interface/fields";
|
2024-12-05 16:58:57 +08:00
|
|
|
|
import { useMemo } from "react";
|
2024-12-05 02:13:54 +08:00
|
|
|
|
|
2024-12-08 00:55:12 +08:00
|
|
|
|
import { ImageLoader } from "hooks/ParticleImage";
|
2024-12-07 02:25:28 +08:00
|
|
|
|
import { getColorScheme, hashString } from "themes/echoes/utils/colorScheme";
|
2024-12-05 02:13:54 +08:00
|
|
|
|
|
2024-12-07 02:25:28 +08:00
|
|
|
|
// 修改模拟文章列表数据
|
|
|
|
|
const mockArticles: PostDisplay[] = [
|
2024-12-05 02:13:54 +08:00
|
|
|
|
{
|
|
|
|
|
id: 1,
|
|
|
|
|
title: "构建现代化的前端开发工作流",
|
|
|
|
|
content: "在现代前端开发中,一个高效的工作流程对于提高开发效率至关重要...",
|
|
|
|
|
authorName: "张三",
|
|
|
|
|
publishedAt: new Date("2024-03-15"),
|
2024-12-11 17:09:20 +08:00
|
|
|
|
coverImage: "https://www.helloimg.com/i/2024/12/11/6759312352499.png",
|
2024-12-05 02:13:54 +08:00
|
|
|
|
status: "published",
|
|
|
|
|
isEditor: false,
|
|
|
|
|
createdAt: new Date("2024-03-15"),
|
2024-12-05 16:58:57 +08:00
|
|
|
|
updatedAt: new Date("2024-03-15"),
|
2024-12-09 21:03:05 +08:00
|
|
|
|
taxonomies: {
|
2024-12-12 23:27:36 +08:00
|
|
|
|
categories: [{ name: "前端开发", slug: "frontend", type: "category" }],
|
2024-12-09 21:03:05 +08:00
|
|
|
|
tags: [
|
|
|
|
|
{ name: "工程化", slug: "engineering", type: "tag" },
|
2024-12-12 23:27:36 +08:00
|
|
|
|
{ name: "效率提升", slug: "efficiency", type: "tag" },
|
|
|
|
|
],
|
|
|
|
|
},
|
2024-12-05 02:13:54 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 2,
|
|
|
|
|
title: "React 18 新特性详解",
|
2024-12-12 23:27:36 +08:00
|
|
|
|
content:
|
|
|
|
|
"React 18 带来了许多令人兴奋的新特性,包括并发渲染、自动批处理更新...",
|
2024-12-05 02:13:54 +08:00
|
|
|
|
authorName: "李四",
|
|
|
|
|
publishedAt: new Date("2024-03-14"),
|
2024-12-08 19:19:54 +08:00
|
|
|
|
coverImage: "",
|
2024-12-05 02:13:54 +08:00
|
|
|
|
status: "published",
|
|
|
|
|
isEditor: false,
|
|
|
|
|
createdAt: new Date("2024-03-14"),
|
2024-12-05 16:58:57 +08:00
|
|
|
|
updatedAt: new Date("2024-03-14"),
|
2024-12-09 21:03:05 +08:00
|
|
|
|
taxonomies: {
|
2024-12-12 23:27:36 +08:00
|
|
|
|
categories: [{ name: "前端开发", slug: "frontend", type: "category" }],
|
2024-12-09 21:03:05 +08:00
|
|
|
|
tags: [
|
|
|
|
|
{ name: "React", slug: "react", type: "tag" },
|
2024-12-12 23:27:36 +08:00
|
|
|
|
{ name: "JavaScript", slug: "javascript", type: "tag" },
|
|
|
|
|
],
|
|
|
|
|
},
|
2024-12-05 02:13:54 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 3,
|
|
|
|
|
title: "JavaScript 性能优化技巧",
|
2024-12-12 23:27:36 +08:00
|
|
|
|
content:
|
|
|
|
|
"在这篇文章中,我们将探讨一些提高 JavaScript 性能的技巧和最佳实践...",
|
2024-12-05 02:13:54 +08:00
|
|
|
|
authorName: "王五",
|
|
|
|
|
publishedAt: new Date("2024-03-13"),
|
2024-12-09 02:25:32 +08:00
|
|
|
|
coverImage: "ssssxx",
|
2024-12-05 02:13:54 +08:00
|
|
|
|
status: "published",
|
|
|
|
|
isEditor: false,
|
|
|
|
|
createdAt: new Date("2024-03-13"),
|
2024-12-05 16:58:57 +08:00
|
|
|
|
updatedAt: new Date("2024-03-13"),
|
2024-12-09 21:03:05 +08:00
|
|
|
|
taxonomies: {
|
|
|
|
|
categories: [
|
2024-12-12 23:27:36 +08:00
|
|
|
|
{
|
|
|
|
|
name: "性能优化",
|
|
|
|
|
slug: "performance-optimization",
|
|
|
|
|
type: "category",
|
|
|
|
|
},
|
2024-12-09 21:03:05 +08:00
|
|
|
|
],
|
|
|
|
|
tags: [
|
|
|
|
|
{ name: "JavaScript", slug: "javascript", type: "tag" },
|
2024-12-12 23:27:36 +08:00
|
|
|
|
{ name: "性能", slug: "performance", type: "tag" },
|
|
|
|
|
],
|
|
|
|
|
},
|
2024-12-05 16:58:57 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 4,
|
2024-12-07 02:25:28 +08:00
|
|
|
|
title: "移动端适配最佳实践",
|
|
|
|
|
content: "移动端开发中的各种适配问题及解决方案...",
|
2024-12-05 16:58:57 +08:00
|
|
|
|
authorName: "田六",
|
|
|
|
|
publishedAt: new Date("2024-03-13"),
|
2024-12-12 23:27:36 +08:00
|
|
|
|
coverImage:
|
|
|
|
|
"https://images.unsplash.com/photo-1537432376769-00f5c2f4c8d2?w=500&auto=format",
|
2024-12-05 16:58:57 +08:00
|
|
|
|
status: "published",
|
|
|
|
|
isEditor: false,
|
|
|
|
|
createdAt: new Date("2024-03-13"),
|
|
|
|
|
updatedAt: new Date("2024-03-13"),
|
2024-12-09 21:03:05 +08:00
|
|
|
|
taxonomies: {
|
|
|
|
|
categories: [
|
2024-12-12 23:27:36 +08:00
|
|
|
|
{ name: "移动开发", slug: "mobile-development", type: "category" },
|
2024-12-09 21:03:05 +08:00
|
|
|
|
],
|
|
|
|
|
tags: [
|
|
|
|
|
{ name: "移动端", slug: "mobile", type: "tag" },
|
2024-12-12 23:27:36 +08:00
|
|
|
|
{ name: "响应式", slug: "responsive", type: "tag" },
|
|
|
|
|
],
|
|
|
|
|
},
|
2024-12-05 02:13:54 +08:00
|
|
|
|
},
|
2024-12-07 02:25:28 +08:00
|
|
|
|
{
|
|
|
|
|
id: 5,
|
|
|
|
|
title: "全栈开发:从前端到云原生的完整指南",
|
2024-12-12 23:27:36 +08:00
|
|
|
|
content:
|
|
|
|
|
"本文将深入探讨现代全栈开发的各个方面,包括前端框架选择、后端架构设计、数据库优化、微服务部署以及云原生实践...",
|
2024-12-07 02:25:28 +08:00
|
|
|
|
authorName: "赵七",
|
|
|
|
|
publishedAt: new Date("2024-03-12"),
|
2024-12-12 23:27:36 +08:00
|
|
|
|
coverImage:
|
|
|
|
|
"https://images.unsplash.com/photo-1537432376769-00f5c2f4c8d2?w=500&auto=format",
|
2024-12-07 02:25:28 +08:00
|
|
|
|
status: "published",
|
|
|
|
|
isEditor: false,
|
|
|
|
|
createdAt: new Date("2024-03-12"),
|
|
|
|
|
updatedAt: new Date("2024-03-12"),
|
2024-12-09 21:03:05 +08:00
|
|
|
|
taxonomies: {
|
|
|
|
|
categories: [
|
|
|
|
|
{ name: "全栈开发", slug: "full-stack-development", type: "category" },
|
|
|
|
|
{ name: "云原生", slug: "cloud-native", type: "category" },
|
|
|
|
|
{ name: "微服务", slug: "microservices", type: "category" },
|
|
|
|
|
{ name: "DevOps", slug: "devops", type: "category" },
|
2024-12-12 23:27:36 +08:00
|
|
|
|
{ name: "系统架构", slug: "system-architecture", type: "category" },
|
2024-12-09 21:03:05 +08:00
|
|
|
|
],
|
|
|
|
|
tags: [
|
|
|
|
|
{ name: "React", slug: "react", type: "tag" },
|
|
|
|
|
{ name: "Node.js", slug: "node-js", type: "tag" },
|
|
|
|
|
{ name: "Docker", slug: "docker", type: "tag" },
|
|
|
|
|
{ name: "Kubernetes", slug: "kubernetes", type: "tag" },
|
|
|
|
|
{ name: "MongoDB", slug: "mongodb", type: "tag" },
|
|
|
|
|
{ name: "微服务", slug: "microservices", type: "tag" },
|
|
|
|
|
{ name: "CI/CD", slug: "ci-cd", type: "tag" },
|
2024-12-12 23:27:36 +08:00
|
|
|
|
{ name: "云计算", slug: "cloud-computing", type: "tag" },
|
|
|
|
|
],
|
|
|
|
|
},
|
2024-12-07 02:25:28 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 6,
|
|
|
|
|
title: "深入浅出 TypeScript 高级特性",
|
2024-12-12 23:27:36 +08:00
|
|
|
|
content:
|
|
|
|
|
"探索 TypeScript 的高级类型系统、装饰器、类型编程等特性,以及在大型项目中的最佳实践...",
|
2024-12-07 02:25:28 +08:00
|
|
|
|
authorName: "孙八",
|
|
|
|
|
publishedAt: new Date("2024-03-11"),
|
2024-12-12 23:27:36 +08:00
|
|
|
|
coverImage:
|
|
|
|
|
"https://images.unsplash.com/photo-1516116216624-53e697fedbea?w=500&auto=format",
|
2024-12-07 02:25:28 +08:00
|
|
|
|
status: "published",
|
|
|
|
|
isEditor: false,
|
|
|
|
|
createdAt: new Date("2024-03-11"),
|
|
|
|
|
updatedAt: new Date("2024-03-11"),
|
2024-12-09 21:03:05 +08:00
|
|
|
|
taxonomies: {
|
|
|
|
|
categories: [
|
|
|
|
|
{ name: "TypeScript", slug: "typescript", type: "category" },
|
2024-12-12 23:27:36 +08:00
|
|
|
|
{ name: "编程语言", slug: "programming-languages", type: "category" },
|
2024-12-09 21:03:05 +08:00
|
|
|
|
],
|
|
|
|
|
tags: [
|
|
|
|
|
{ name: "类型系统", slug: "type-system", type: "tag" },
|
|
|
|
|
{ name: "泛型编程", slug: "generic-programming", type: "tag" },
|
|
|
|
|
{ name: "装饰器", slug: "decorators", type: "tag" },
|
2024-12-12 23:27:36 +08:00
|
|
|
|
{ name: "类型推导", slug: "type-inference", type: "tag" },
|
|
|
|
|
],
|
|
|
|
|
},
|
2024-12-07 02:25:28 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 7,
|
|
|
|
|
title: "Web 性能优化:从理论到实践",
|
2024-12-12 23:27:36 +08:00
|
|
|
|
content:
|
|
|
|
|
"全面解析 Web 性能优化策略,包括资源加载优化、渲染性能优化、网络优化等多个...",
|
2024-12-07 02:25:28 +08:00
|
|
|
|
authorName: "周九",
|
|
|
|
|
publishedAt: new Date("2024-03-10"),
|
2024-12-12 23:27:36 +08:00
|
|
|
|
coverImage:
|
|
|
|
|
"https://images.unsplash.com/photo-1451187580459-43490279c0fa?w=500&auto=format",
|
2024-12-07 02:25:28 +08:00
|
|
|
|
status: "published",
|
|
|
|
|
isEditor: false,
|
|
|
|
|
createdAt: new Date("2024-03-10"),
|
|
|
|
|
updatedAt: new Date("2024-03-10"),
|
2024-12-09 21:03:05 +08:00
|
|
|
|
taxonomies: {
|
|
|
|
|
categories: [
|
2024-12-12 23:27:36 +08:00
|
|
|
|
{
|
|
|
|
|
name: "性能优化",
|
|
|
|
|
slug: "performance-optimization",
|
|
|
|
|
type: "category",
|
|
|
|
|
},
|
|
|
|
|
{ name: "前端开发", slug: "frontend-development", type: "category" },
|
2024-12-09 21:03:05 +08:00
|
|
|
|
],
|
|
|
|
|
tags: [
|
|
|
|
|
{ name: "性能监控", slug: "performance-monitoring", type: "tag" },
|
|
|
|
|
{ name: "懒加载", slug: "lazy-loading", type: "tag" },
|
|
|
|
|
{ name: "缓存策略", slug: "caching-strategies", type: "tag" },
|
2024-12-12 23:27:36 +08:00
|
|
|
|
{ name: "代码分割", slug: "code-splitting", type: "tag" },
|
|
|
|
|
],
|
|
|
|
|
},
|
2024-12-07 02:25:28 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 8,
|
|
|
|
|
title: "微前端架构实践指南",
|
2024-12-12 23:27:36 +08:00
|
|
|
|
content:
|
|
|
|
|
"详细介绍微前端的架构设计、实现方案、应用集成以及实际项目中的经验总结...",
|
2024-12-07 02:25:28 +08:00
|
|
|
|
authorName: "吴十",
|
|
|
|
|
publishedAt: new Date("2024-03-09"),
|
2024-12-12 23:27:36 +08:00
|
|
|
|
coverImage:
|
|
|
|
|
"https://images.unsplash.com/photo-1517180102446-f3ece451e9d8?w=500&auto=format",
|
2024-12-07 02:25:28 +08:00
|
|
|
|
status: "published",
|
|
|
|
|
isEditor: false,
|
|
|
|
|
createdAt: new Date("2024-03-09"),
|
|
|
|
|
updatedAt: new Date("2024-03-09"),
|
2024-12-09 21:03:05 +08:00
|
|
|
|
taxonomies: {
|
|
|
|
|
categories: [
|
|
|
|
|
{ name: "架构设计", slug: "architecture-design", type: "category" },
|
2024-12-12 23:27:36 +08:00
|
|
|
|
{ name: "微前端", slug: "micro-frontends", type: "category" },
|
2024-12-09 21:03:05 +08:00
|
|
|
|
],
|
|
|
|
|
tags: [
|
|
|
|
|
{ name: "qiankun", slug: "qiankun", type: "tag" },
|
|
|
|
|
{ name: "single-spa", slug: "single-spa", type: "tag" },
|
|
|
|
|
{ name: "模块联邦", slug: "module-federation", type: "tag" },
|
2024-12-12 23:27:36 +08:00
|
|
|
|
{ name: "应用通信", slug: "application-communication", type: "tag" },
|
|
|
|
|
],
|
|
|
|
|
},
|
2024-12-11 17:09:20 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 9,
|
|
|
|
|
title: "AI 驱动的前端开发:从概念到实践",
|
2024-12-12 23:27:36 +08:00
|
|
|
|
content:
|
|
|
|
|
"探索如何将人工智能技术融入前端开发流程,包括智能代码补全、自动化测试、UI 生成、性能优化建议等实践应用...",
|
2024-12-11 17:09:20 +08:00
|
|
|
|
authorName: "陈十一",
|
|
|
|
|
publishedAt: new Date("2024-03-08"),
|
2024-12-12 23:27:36 +08:00
|
|
|
|
coverImage:
|
|
|
|
|
"https://images.unsplash.com/photo-1677442136019-21780ecad995?w=500&auto=format",
|
2024-12-11 17:09:20 +08:00
|
|
|
|
status: "published",
|
|
|
|
|
isEditor: false,
|
|
|
|
|
createdAt: new Date("2024-03-08"),
|
|
|
|
|
updatedAt: new Date("2024-03-08"),
|
|
|
|
|
taxonomies: {
|
|
|
|
|
categories: [
|
|
|
|
|
{ name: "人工智能", slug: "artificial-intelligence", type: "category" },
|
2024-12-12 23:27:36 +08:00
|
|
|
|
{ name: "前端开发", slug: "frontend-development", type: "category" },
|
2024-12-11 17:09:20 +08:00
|
|
|
|
],
|
|
|
|
|
tags: [
|
|
|
|
|
{ name: "AI开发", slug: "ai-development", type: "tag" },
|
|
|
|
|
{ name: "智能化", slug: "intelligence", type: "tag" },
|
|
|
|
|
{ name: "自动化", slug: "automation", type: "tag" },
|
2024-12-12 23:27:36 +08:00
|
|
|
|
{ name: "开发效率", slug: "development-efficiency", type: "tag" },
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-12-05 16:58:57 +08:00
|
|
|
|
];
|
2024-12-05 02:13:54 +08:00
|
|
|
|
|
2024-12-05 16:58:57 +08:00
|
|
|
|
export default new Template({}, ({ http, args }) => {
|
2024-12-07 02:25:28 +08:00
|
|
|
|
const articleData = useMemo(() => mockArticles, []);
|
|
|
|
|
const totalPages = 25; // 假设有25页
|
|
|
|
|
const currentPage = 1; // 当前页码
|
2024-12-12 23:27:36 +08:00
|
|
|
|
|
2024-12-07 02:25:28 +08:00
|
|
|
|
// 修改生成分页数组的函数,不再需要省略号
|
|
|
|
|
const getPageNumbers = (total: number) => {
|
|
|
|
|
return Array.from({ length: total }, (_, i) => i + 1);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 修改分页部分的渲染
|
|
|
|
|
const renderPageNumbers = () => {
|
|
|
|
|
const pages = getPageNumbers(totalPages);
|
2024-12-12 23:27:36 +08:00
|
|
|
|
|
|
|
|
|
return pages.map((page) => (
|
|
|
|
|
<div
|
2024-12-07 02:25:28 +08:00
|
|
|
|
key={page}
|
|
|
|
|
className={`min-w-[32px] h-8 rounded-md transition-all duration-300 cursor-pointer
|
|
|
|
|
flex items-center justify-center group/item whitespace-nowrap
|
2024-12-12 23:27:36 +08:00
|
|
|
|
${
|
|
|
|
|
page === currentPage
|
|
|
|
|
? "bg-[--accent-9] text-[--text-primary]"
|
|
|
|
|
: "text-[--text-secondary] hover:text-[--text-primary] hover:bg-[--accent-3]"
|
2024-12-07 02:25:28 +08:00
|
|
|
|
}`}
|
|
|
|
|
>
|
2024-12-12 23:27:36 +08:00
|
|
|
|
<Text
|
|
|
|
|
size="1"
|
2024-12-07 02:25:28 +08:00
|
|
|
|
weight={page === currentPage ? "medium" : "regular"}
|
|
|
|
|
className="group-hover/item:scale-110 transition-transform"
|
|
|
|
|
>
|
|
|
|
|
{page}
|
|
|
|
|
</Text>
|
|
|
|
|
</div>
|
|
|
|
|
));
|
|
|
|
|
};
|
2024-12-05 16:58:57 +08:00
|
|
|
|
|
|
|
|
|
return (
|
2024-12-07 02:25:28 +08:00
|
|
|
|
<Container size="3" className="pt-2 pb-4 relative">
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-4 md:gap-6 px-4 md:px-0 mb-6 md:mb-8">
|
2024-12-05 16:58:57 +08:00
|
|
|
|
{articleData.map((article) => (
|
|
|
|
|
<Card
|
|
|
|
|
key={article.id}
|
2024-12-09 02:25:32 +08:00
|
|
|
|
className="group cursor-pointer hover-card border border-[--gray-a3]"
|
2024-12-05 16:58:57 +08:00
|
|
|
|
>
|
2024-12-05 22:46:29 +08:00
|
|
|
|
<div className="p-4 relative flex flex-col gap-4">
|
|
|
|
|
<div className="flex gap-4">
|
2024-12-07 02:25:28 +08:00
|
|
|
|
<div className="w-[120px] h-[90px] flex-shrink-0">
|
2024-12-06 11:51:40 +08:00
|
|
|
|
<ImageLoader
|
|
|
|
|
src={article.coverImage}
|
|
|
|
|
alt={article.title || ""}
|
2024-12-07 02:25:28 +08:00
|
|
|
|
className="w-full h-full group-hover:scale-105 transition-transform duration-500
|
|
|
|
|
relative z-[1] object-cover rounded-lg opacity-90
|
|
|
|
|
group-hover:opacity-100"
|
2024-12-06 11:51:40 +08:00
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-12-05 16:58:57 +08:00
|
|
|
|
|
2024-12-05 22:46:29 +08:00
|
|
|
|
<div className="flex-1 min-w-0">
|
2024-12-05 16:58:57 +08:00
|
|
|
|
<Heading
|
2024-12-07 02:25:28 +08:00
|
|
|
|
size="2"
|
|
|
|
|
className="text-[--text-primary] group-hover:text-[--accent-9]
|
|
|
|
|
transition-colors duration-200 line-clamp-2 mb-2"
|
2024-12-05 16:58:57 +08:00
|
|
|
|
>
|
|
|
|
|
{article.title}
|
|
|
|
|
</Heading>
|
2024-12-05 22:46:29 +08:00
|
|
|
|
|
2024-12-12 23:27:36 +08:00
|
|
|
|
<Text
|
|
|
|
|
className="text-[--text-secondary] text-xs
|
|
|
|
|
line-clamp-2 leading-relaxed"
|
|
|
|
|
>
|
2024-12-05 22:46:29 +08:00
|
|
|
|
{article.content}
|
|
|
|
|
</Text>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2024-12-07 02:25:28 +08:00
|
|
|
|
<div className="flex flex-col gap-2">
|
|
|
|
|
<div className="flex items-center gap-3">
|
2024-12-12 23:27:36 +08:00
|
|
|
|
<ScrollArea
|
|
|
|
|
type="hover"
|
|
|
|
|
scrollbars="horizontal"
|
2024-12-09 02:25:32 +08:00
|
|
|
|
className="scroll-container flex-1"
|
|
|
|
|
>
|
2024-12-07 02:25:28 +08:00
|
|
|
|
<Flex gap="2" className="flex-nowrap">
|
2024-12-09 21:03:05 +08:00
|
|
|
|
{article.taxonomies?.categories.map((category) => (
|
2024-12-07 02:25:28 +08:00
|
|
|
|
<Text
|
|
|
|
|
key={category.name}
|
|
|
|
|
size="2"
|
|
|
|
|
className={`px-3 py-0.5 rounded-md font-medium transition-colors cursor-pointer
|
|
|
|
|
whitespace-nowrap
|
|
|
|
|
${getColorScheme(category.name).bg}
|
|
|
|
|
${getColorScheme(category.name).text}
|
|
|
|
|
border ${getColorScheme(category.name).border}
|
|
|
|
|
${getColorScheme(category.name).hover}`}
|
|
|
|
|
>
|
|
|
|
|
{category.name}
|
|
|
|
|
</Text>
|
|
|
|
|
))}
|
|
|
|
|
</Flex>
|
|
|
|
|
</ScrollArea>
|
2024-12-05 02:13:54 +08:00
|
|
|
|
|
2024-12-12 23:27:36 +08:00
|
|
|
|
<Flex
|
|
|
|
|
gap="2"
|
|
|
|
|
align="center"
|
|
|
|
|
className="text-[--text-tertiary] flex-shrink-0"
|
|
|
|
|
>
|
2024-12-07 02:25:28 +08:00
|
|
|
|
<CalendarIcon className="w-4 h-4" />
|
|
|
|
|
<Text size="2">
|
2024-12-05 22:46:29 +08:00
|
|
|
|
{article.publishedAt?.toLocaleDateString("zh-CN", {
|
|
|
|
|
year: "numeric",
|
|
|
|
|
month: "long",
|
|
|
|
|
day: "numeric",
|
|
|
|
|
})}
|
|
|
|
|
</Text>
|
|
|
|
|
<span className="mx-1">·</span>
|
2024-12-07 02:25:28 +08:00
|
|
|
|
<Text size="2" weight="medium">
|
2024-12-05 22:46:29 +08:00
|
|
|
|
{article.authorName}
|
|
|
|
|
</Text>
|
|
|
|
|
</Flex>
|
|
|
|
|
</div>
|
2024-12-05 16:58:57 +08:00
|
|
|
|
|
2024-12-05 22:46:29 +08:00
|
|
|
|
<Flex gap="2" className="flex-wrap">
|
2024-12-09 21:03:05 +08:00
|
|
|
|
{article.taxonomies?.tags.map((tag) => (
|
2024-12-05 16:58:57 +08:00
|
|
|
|
<Text
|
|
|
|
|
key={tag.name}
|
|
|
|
|
size="1"
|
2024-12-07 02:25:28 +08:00
|
|
|
|
className={`px-2.5 py-0.5 rounded-md transition-colors cursor-pointer
|
|
|
|
|
flex items-center gap-1.5
|
|
|
|
|
${getColorScheme(tag.name).bg} ${getColorScheme(tag.name).text}
|
|
|
|
|
border ${getColorScheme(tag.name).border} ${getColorScheme(tag.name).hover}`}
|
2024-12-05 02:13:54 +08:00
|
|
|
|
>
|
2024-12-12 23:27:36 +08:00
|
|
|
|
<span
|
2024-12-07 02:25:28 +08:00
|
|
|
|
className={`inline-block w-1 h-1 rounded-full ${getColorScheme(tag.name).dot}`}
|
2024-12-12 23:27:36 +08:00
|
|
|
|
style={{
|
2024-12-07 02:25:28 +08:00
|
|
|
|
flexShrink: 0,
|
2024-12-12 23:27:36 +08:00
|
|
|
|
opacity: 0.8,
|
2024-12-07 02:25:28 +08:00
|
|
|
|
}}
|
|
|
|
|
/>
|
2024-12-05 16:58:57 +08:00
|
|
|
|
{tag.name}
|
2024-12-05 02:13:54 +08:00
|
|
|
|
</Text>
|
2024-12-05 16:58:57 +08:00
|
|
|
|
))}
|
|
|
|
|
</Flex>
|
2024-12-05 02:13:54 +08:00
|
|
|
|
</div>
|
2024-12-05 16:58:57 +08:00
|
|
|
|
</div>
|
|
|
|
|
</Card>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
|
2024-12-07 02:25:28 +08:00
|
|
|
|
<div className="px-4 md:px-0">
|
2024-12-12 23:27:36 +08:00
|
|
|
|
<Flex
|
|
|
|
|
align="center"
|
|
|
|
|
justify="between"
|
2024-12-07 02:25:28 +08:00
|
|
|
|
className="max-w-[800px] mx-auto"
|
|
|
|
|
>
|
2024-12-12 23:27:36 +08:00
|
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
2024-12-07 02:25:28 +08:00
|
|
|
|
className="group/nav h-8 md:px-3 text-sm hidden md:flex"
|
|
|
|
|
disabled={true}
|
|
|
|
|
>
|
|
|
|
|
<ChevronLeftIcon className="w-4 h-4 md:mr-1 text-[--text-tertiary] group-hover/nav:-translate-x-0.5 transition-transform" />
|
|
|
|
|
<span className="hidden md:inline">上一页</span>
|
|
|
|
|
</Button>
|
|
|
|
|
|
2024-12-12 23:27:36 +08:00
|
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
2024-12-07 02:25:28 +08:00
|
|
|
|
className="group/nav w-8 h-8 md:hidden"
|
|
|
|
|
disabled={true}
|
|
|
|
|
>
|
|
|
|
|
<ChevronLeftIcon className="w-4 h-4 text-[--text-tertiary]" />
|
|
|
|
|
</Button>
|
|
|
|
|
|
2024-12-12 23:27:36 +08:00
|
|
|
|
<Flex
|
|
|
|
|
align="center"
|
|
|
|
|
gap="2"
|
|
|
|
|
className="flex-1 md:flex-none justify-center"
|
|
|
|
|
>
|
|
|
|
|
<ScrollArea
|
|
|
|
|
type="hover"
|
|
|
|
|
scrollbars="horizontal"
|
2024-12-07 02:25:28 +08:00
|
|
|
|
className="w-[240px] md:w-[400px]"
|
|
|
|
|
>
|
|
|
|
|
<Flex gap="1" className="px-2">
|
|
|
|
|
{renderPageNumbers()}
|
|
|
|
|
</Flex>
|
|
|
|
|
</ScrollArea>
|
|
|
|
|
|
2024-12-12 23:27:36 +08:00
|
|
|
|
<Text
|
|
|
|
|
size="1"
|
|
|
|
|
className="text-[--text-tertiary] whitespace-nowrap hidden md:block"
|
|
|
|
|
>
|
2024-12-07 02:25:28 +08:00
|
|
|
|
共 {totalPages} 页
|
|
|
|
|
</Text>
|
|
|
|
|
</Flex>
|
2024-12-05 16:58:57 +08:00
|
|
|
|
|
2024-12-12 23:27:36 +08:00
|
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
2024-12-07 02:25:28 +08:00
|
|
|
|
className="group/nav h-8 md:px-3 text-sm hidden md:flex"
|
2024-12-05 02:13:54 +08:00
|
|
|
|
>
|
2024-12-07 02:25:28 +08:00
|
|
|
|
<span className="hidden md:inline">下一页</span>
|
|
|
|
|
<ChevronRightIcon className="w-4 h-4 md:ml-1 text-[--text-tertiary] group-hover/nav:translate-x-0.5 transition-transform" />
|
2024-12-05 02:13:54 +08:00
|
|
|
|
</Button>
|
2024-12-05 16:58:57 +08:00
|
|
|
|
|
2024-12-12 23:27:36 +08:00
|
|
|
|
<Button variant="ghost" className="group/nav w-8 h-8 md:hidden">
|
2024-12-07 02:25:28 +08:00
|
|
|
|
<ChevronRightIcon className="w-4 h-4 text-[--text-tertiary]" />
|
|
|
|
|
</Button>
|
|
|
|
|
</Flex>
|
|
|
|
|
</div>
|
2024-12-05 16:58:57 +08:00
|
|
|
|
</Container>
|
|
|
|
|
);
|
|
|
|
|
});
|