Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

DiffFileLoadingBoundary.tsx

27 lines784 Bytes

1import { observeIntersection } from "~/lib/observeIntersection";
2import { DiffFileHeaderSkeleton } from "../DiffPanelShell";
3​
4export function DiffFileLoadingBoundary({ load, count }: { load: () => void; count: number }) {
5 return (
6 <div
7 ref={(node) => {
8 if (!node) return;
9 return observeIntersection(
10 node,
11 (entry) => {
12 if (entry.isIntersecting) load();
13 },
14 { rootMargin: "600px" },
15 );
16 }}
17 role="status"
18 aria-label="Loading diff…"
19 >
20 {Array.from({ length: Math.min(count, 4) }, (_, index) => (
21 <div key={index} aria-hidden className="border-b border-border/40">
22 <DiffFileHeaderSkeleton titleWidth="medium" />
23 </div>
24 ))}
25 </div>
26 );