-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathWithInfiniteScroll.tsx
More file actions
42 lines (40 loc) · 1.18 KB
/
WithInfiniteScroll.tsx
File metadata and controls
42 lines (40 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import React from "react";
import InfiniteScroll from "react-infinite-scroller";
import CommitGraph from ".";
import { Branch, Commit, CommitNode, Diff, GraphStyle } from "../../types";
import css from "./index.module.css";
type Props = {
commits: Commit[];
branchHeads: Branch[];
loadMore: () => void;
hasMore: boolean;
parentID?: string;
graphStyle?: GraphStyle;
dateFormatFn?: (d: string | number | Date) => string;
currentBranch?: string;
fullSha?: boolean;
onCommitClick?: (commit: CommitNode) => void;
getDiff?: (base: string, head: string) => Promise<Diff | undefined>;
};
export default function WithInfiniteScroll(props: Props) {
return (
<div id="scroll-container" className={css.scrollContainer}>
<InfiniteScroll
loadMore={props.loadMore}
hasMore={props.hasMore}
useWindow={!props.parentID}
initialLoad={false}
loader={
<div className={css.loader} key={0}>
Loading graph...
</div>
}
getScrollParent={() =>
props.parentID ? document.getElementById(props.parentID) : null
}
>
<CommitGraph {...props} />
</InfiniteScroll>
</div>
);
}