修复部分NOTION_CONFIG读取问题

This commit is contained in:
tangly1024.com
2024-05-15 14:55:14 +08:00
parent 70e53649b3
commit 517a967640
44 changed files with 911 additions and 565 deletions

View File

@@ -1,5 +1,6 @@
import BlogPostCard from './BlogPostCard'
import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
import BlogPostCard from './BlogPostCard'
import BlogPostListEmpty from './BlogPostListEmpty'
import PaginationSimple from './PaginationSimple'
@@ -12,22 +13,24 @@ import PaginationSimple from './PaginationSimple'
* @constructor
*/
const BlogPostListPage = ({ page = 1, posts = [], postCount }) => {
const totalPage = Math.ceil(postCount / parseInt(siteConfig('POSTS_PER_PAGE')))
const { NOTION_CONFIG } = useGlobal()
const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG)
const totalPage = Math.ceil(postCount / POSTS_PER_PAGE)
if (!posts || posts.length === 0) {
return <BlogPostListEmpty />
}
return (
<div className='w-full justify-center'>
<div id='posts-wrapper'>
<div className='w-full justify-center'>
<div id='posts-wrapper'>
{/* 文章列表 */}
{posts?.map(post => (
<BlogPostCard key={post.id} post={post} />
))}
</div>
<PaginationSimple page={page} totalPage={totalPage} />
</div>
<PaginationSimple page={page} totalPage={totalPage} />
</div>
)
}