import { FC } from 'react'; import { VirtuosoGrid, VirtuosoGridProps } from 'react-virtuoso'; import { showPreviewModal } from '@/components/Preview'; import Card from '@/components/Show'; interface Props { shows: Show[]; customScrollParent?: HTMLElement; fetchNextPage?: () => void; onPreviewClose?: () => void; } const components: VirtuosoGridProps void }>['components'] = { Item: ({ context, 'data-index': index }) => { const { shows, onClick } = context!; const show = shows?.[index]; if (!show) return null; return onClick?.(show)} />; } }; const List: FC = ({ shows, fetchNextPage, onPreviewClose, customScrollParent }) => { if (!shows.length) return null; const context = { shows, onClick: (show: Show) => showPreviewModal({ show, onClose: onPreviewClose }) }; const handleFetchMore = () => fetchNextPage?.(); return ( <>
); }; export default List;