Files
blitzkit/src/app/tools/tank-performance/components/RowLoader.tsx
T

31 lines
935 B
TypeScript
Raw Normal View History

2024-06-30 19:59:32 -05:00
import { Skeleton, Table } from '@radix-ui/themes';
import { times } from 'lodash';
2024-07-07 18:01:56 -05:00
import { useRef } from 'react';
import { useIntersection } from '../../../../hooks/useIntersection';
2024-07-06 20:07:46 -05:00
import { tankPerformanceSortTypeNamesArray } from '../../../../stores/tankPerformanceSort';
2024-06-30 19:59:32 -05:00
2024-07-06 20:32:41 -05:00
interface RowLoaderProps {
onIntersection?: () => void;
}
export function RowLoader({ onIntersection }: RowLoaderProps) {
const row = useRef<HTMLTableRowElement>(null);
2024-07-07 18:01:56 -05:00
useIntersection(() => onIntersection?.(), row, {
disabled: onIntersection === undefined,
});
2024-07-06 20:32:41 -05:00
2024-06-30 19:59:32 -05:00
return (
2024-07-06 20:32:41 -05:00
<Table.Row ref={row}>
2024-06-30 20:34:22 -05:00
<Table.RowHeaderCell align="center">
2024-06-30 19:59:32 -05:00
<Skeleton height="100%" width="128px" />
</Table.RowHeaderCell>
2024-07-06 20:07:46 -05:00
{times(tankPerformanceSortTypeNamesArray.length, (index) => (
2024-06-30 20:34:22 -05:00
<Table.Cell key={index} align="center">
2024-06-30 19:59:32 -05:00
<Skeleton height="1em" width="32px" />
</Table.Cell>
))}
</Table.Row>
);
}