| | import BlogPostCard from './BlogPostCard' |
| | import PaginationNumber from './PaginationNumber' |
| | import BlogPostListEmpty from './BlogPostListEmpty' |
| | import { siteConfig } from '@/lib/config' |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | const BlogPostListPage = ({ page = 1, posts = [], postCount }) => { |
| | const totalPage = Math.ceil(postCount / parseInt(siteConfig('POSTS_PER_PAGE'))) |
| |
|
| | if (!posts || posts.length === 0) { |
| | return <BlogPostListEmpty /> |
| | } else { |
| | return ( |
| | <div> |
| | {/* 文章列表 */} |
| | <div id="posts-wrapper" className="flex flex-wrap lg:space-y-4 space-y-1"> |
| | {posts?.map((post, index) => ( |
| | <BlogPostCard key={post.id} index={index} post={post} /> |
| | ))} |
| | </div> |
| | <PaginationNumber page={page} totalPage={totalPage} /> |
| | </div> |
| | ) |
| | } |
| | } |
| |
|
| | export default BlogPostListPage |
| |
|