noRowRenderer.tsx 806 B

123456789101112131415161718192021222324252627282930313233
  1. import {ReactNode} from 'react';
  2. import {Button} from 'sentry/components/button';
  3. import {IconClose} from 'sentry/icons';
  4. import {t} from 'sentry/locale';
  5. import EmptyState from 'sentry/views/replays/detail/emptyState';
  6. type Props = {
  7. children: ReactNode;
  8. clearSearchTerm: () => void;
  9. unfilteredItems: unknown[];
  10. };
  11. function NoRowRenderer({children, unfilteredItems, clearSearchTerm}: Props) {
  12. return unfilteredItems.length === 0 ? (
  13. <EmptyState>
  14. <p>{children}</p>
  15. </EmptyState>
  16. ) : (
  17. <EmptyState>
  18. <p>{t('No results found')}</p>
  19. <Button
  20. icon={<IconClose color="gray500" size="sm" isCircled />}
  21. onClick={clearSearchTerm}
  22. size="md"
  23. >
  24. {t('Clear filters')}
  25. </Button>
  26. </EmptyState>
  27. );
  28. }
  29. export default NoRowRenderer;