import { Page, PageProps } from '@wix/design-system'; import React, { Children, ReactNode } from 'react'; import { CollectionState, FiltersMap } from '@wix/bex-core'; import { CollectionPageHeader } from '../CollectionPageHeader'; import { InfiniteScrollPage } from '../PageWrapper/InfiniteScrollPage'; import { CollectionProvider } from '../CollectionContext'; import { useCollectionPageState } from '@wix/bex-core/react'; import { usePageHeader } from '../../hooks/usePageHeader'; export interface CollectionPageProps extends PageProps { /** * A collection state instance created with [useCollection](./?path=/story/common-hooks--usecollection) * @external */ state: CollectionState; children?: ReactNode; /** * Hide total items count * @external */ hideTotal?: boolean; } /** * @deprecated Use [CollectionPage](./?path=%2Fstory%2Fbase-components-pages-collection-page--collectionpage) from * `@wix/patterns/page` */ export function CollectionPage({ children, state, hideTotal, ...rest }: CollectionPageProps) { const childrenArr = Children.toArray(children); const { header, title: pageTitle } = usePageHeader(childrenArr); const collectionPageState = useCollectionPageState({ pageTitle }); return ( {header && ( {header.props.title} ) } /> )} {childrenArr.filter((e) => e !== header)} ); }