NoSearchResults.tsx 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { Button, cn } from 'ui'
  2. export interface NoSearchResultsProps {
  3. searchString?: string
  4. withinTableCell?: boolean
  5. onResetFilter?: () => void
  6. className?: string
  7. label?: string
  8. description?: string
  9. }
  10. export const NoSearchResults = ({
  11. searchString,
  12. withinTableCell = false,
  13. onResetFilter,
  14. className,
  15. label,
  16. description,
  17. }: NoSearchResultsProps) => {
  18. return (
  19. <div
  20. className={cn(
  21. 'flex items-center justify-between',
  22. !withinTableCell && 'bg-surface-100 px-4 md:px-6 py-4 rounded-md border border-default',
  23. className
  24. )}
  25. >
  26. <div className="text-sm flex flex-col gap-y-0.5">
  27. <p className="text-foreground">{label ?? 'No results found'}</p>
  28. <p className="text-foreground-lighter">
  29. {description ?? `Your search for “${searchString}” did not return any results`}
  30. </p>
  31. </div>
  32. {onResetFilter !== undefined && (
  33. <Button type="default" onClick={() => onResetFilter()}>
  34. Reset filter
  35. </Button>
  36. )}
  37. </div>
  38. )
  39. }