recatfor
This commit is contained in:
parent
8e365867bd
commit
74c66e74c9
13 changed files with 363 additions and 112 deletions
22
src/feed/FeedView.tsx
Normal file
22
src/feed/FeedView.tsx
Normal file
|
@ -0,0 +1,22 @@
|
|||
import PostsList from '../components/PostsList.tsx'
|
||||
import { useRef } from 'react'
|
||||
import { useIntersectionLoad } from '../hooks/useIntersectionLoad.ts'
|
||||
import { Post } from '../model/posts/posts.ts'
|
||||
|
||||
interface FeedViewProps {
|
||||
pages: Post[][]
|
||||
onLoadMore: () => Promise<void>
|
||||
}
|
||||
|
||||
export default function FeedView({ pages, onLoadMore }: FeedViewProps) {
|
||||
const sentinelRef = useRef<HTMLDivElement | null>(null)
|
||||
|
||||
useIntersectionLoad(onLoadMore, sentinelRef)
|
||||
|
||||
return (
|
||||
<div className="w-full">
|
||||
<PostsList pages={pages} />
|
||||
<div ref={sentinelRef} className="h-1" />
|
||||
</div>
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue