/** @jsx h */ import { h } from 'preact'; import { cx } from '@algolia/ui-components-shared'; import Template from '../Template/Template'; import type { SearchResults } from 'algoliasearch-helper'; import type { ComponentCSSClasses, Hit } from '../../types'; import type { InfiniteHitsCSSClasses, InfiniteHitsTemplates, } from '../../widgets/infinite-hits/infinite-hits'; import type { SendEventForHits, BindEventForHits } from '../../lib/utils'; export type InfiniteHitsComponentCSSClasses = ComponentCSSClasses; export type InfiniteHitsComponentTemplates = Required; export type InfiniteHitsProps = { cssClasses: InfiniteHitsComponentCSSClasses; hits: Hit[]; results: SearchResults; hasShowPrevious: boolean; showPrevious: () => void; showMore: () => void; templateProps: { [key: string]: any; templates: InfiniteHitsComponentTemplates; }; isFirstPage: boolean; isLastPage: boolean; sendEvent: SendEventForHits; bindEvent: BindEventForHits; }; const InfiniteHits = ({ results, hits, bindEvent, sendEvent, hasShowPrevious, showPrevious, showMore, isFirstPage, isLastPage, cssClasses, templateProps, }: InfiniteHitsProps) => { if (results.hits.length === 0) { return (