diff options
author | crupest <crupest@outlook.com> | 2022-05-01 21:30:31 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-05-01 21:30:31 +0800 |
commit | 3f07b047df4d66f83047a5bb747c0a1665bceb6c (patch) | |
tree | 95f2a8814806cdefd9b42b72aea39dd4b39db434 /FrontEnd/src/views/timeline/TimelinePagedPostListView.tsx | |
parent | f15f883198226a146113f82b3d7ca4864f3aa58b (diff) | |
download | timeline-3f07b047df4d66f83047a5bb747c0a1665bceb6c.tar.gz timeline-3f07b047df4d66f83047a5bb747c0a1665bceb6c.tar.bz2 timeline-3f07b047df4d66f83047a5bb747c0a1665bceb6c.zip |
...
Diffstat (limited to 'FrontEnd/src/views/timeline/TimelinePagedPostListView.tsx')
-rw-r--r-- | FrontEnd/src/views/timeline/TimelinePagedPostListView.tsx | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/FrontEnd/src/views/timeline/TimelinePagedPostListView.tsx b/FrontEnd/src/views/timeline/TimelinePagedPostListView.tsx deleted file mode 100644 index 6a0ad0f5..00000000 --- a/FrontEnd/src/views/timeline/TimelinePagedPostListView.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import React from "react"; - -import { HttpTimelinePostInfo } from "@/http/timeline"; - -import { useScrollToTop } from "@/utilities/hooks"; - -import TimelinePostListView from "./TimelinePostListView"; - -export interface TimelinePagedPostListViewProps { - posts: HttpTimelinePostInfo[]; - onReload: () => void; -} - -const TimelinePagedPostListView: React.FC<TimelinePagedPostListViewProps> = ( - props -) => { - const { posts, onReload } = props; - - const [lastViewCount, setLastViewCount] = React.useState<number>(10); - - const viewingPosts = React.useMemo(() => { - return lastViewCount >= posts.length - ? posts.slice() - : posts.slice(-lastViewCount); - }, [posts, lastViewCount]); - - useScrollToTop(() => { - setLastViewCount(lastViewCount + 10); - }, lastViewCount < posts.length); - - return <TimelinePostListView posts={viewingPosts} onReload={onReload} />; -}; - -export default TimelinePagedPostListView; |