import { CollectionState, FiltersMap } from '@wix/bex-core'; import { ReactNode } from 'react'; export function useEmptyStateTexts(props: { state: CollectionState; subtitle?: ReactNode; }) { const { state } = props; const { translate: t, result: { originQuery, hasAvailableItems }, } = state; const { search, rawSearch } = originQuery; const subtitle = (() => { if (props.subtitle) { return props.subtitle; } if (hasAvailableItems && search != null) { return t('cairo.emptyState.subtitle.nothingMatches', { term: rawSearch, }); } if (hasAvailableItems) { return t('cairo.emptyState.subtitle.nothingMatchesCriteria'); } return t('cairo.emptyState.subtitle.nothingAvailable'); })(); const title = t('cairo.emptyState.title'); return { title, subtitle, }; }