File size: 977 Bytes
1b72d7e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import BlogPostCard from './BlogPostCard'
import PaginationNumber from './PaginationNumber'
import BlogPostListEmpty from './BlogPostListEmpty'
import { siteConfig } from '@/lib/config'
/**
* 文章列表分页表格
* @param page 当前页
* @param posts 所有文章
* @param tags 所有标签
* @returns {JSX.Element}
* @constructor
*/
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
|