This commit is contained in:
john 2025-05-04 23:22:45 +02:00
parent 8e365867bd
commit 74c66e74c9
13 changed files with 363 additions and 112 deletions

22
src/feed/FeedView.tsx Normal file
View 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>
)
}