mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
29 lines
831 B
JavaScript
29 lines
831 B
JavaScript
import BlogPostCard from './BlogPostCard'
|
|
import BlogPostListEmpty from './BlogPostListEmpty'
|
|
import React, { useRef } from 'react'
|
|
|
|
/**
|
|
* 博客列表滚动分页
|
|
* @param posts 所有文章
|
|
* @param tags 所有标签
|
|
* @returns {JSX.Element}
|
|
* @constructor
|
|
*/
|
|
const BlogPostListScroll = ({ posts = [], currentSearch }) => {
|
|
const targetRef = useRef(null)
|
|
const filteredPosts = Object.assign(posts)
|
|
|
|
if (!filteredPosts || filteredPosts.length === 0) {
|
|
return <BlogPostListEmpty currentSearch={currentSearch} />
|
|
} else {
|
|
return <div id='container' ref={targetRef} className='w-full'>
|
|
{/* 文章列表 */}
|
|
{filteredPosts?.map(post => (
|
|
<BlogPostCard key={post.id} post={post} showSummary={true} />
|
|
))}
|
|
</div>
|
|
}
|
|
}
|
|
|
|
export default BlogPostListScroll
|