generic-error-boundary-fallback.tsx 1003 B

123456789101112131415161718192021222324252627282930313233
  1. import { FC } from 'react'
  2. import { useTranslation } from 'react-i18next'
  3. import Icon from './icon'
  4. import { Button } from 'react-bootstrap'
  5. import { useLocation } from '../hooks/use-location'
  6. import { DefaultMessage } from './default-message'
  7. export const GenericErrorBoundaryFallback: FC = ({ children }) => {
  8. const { t } = useTranslation()
  9. const { reload: handleClick } = useLocation()
  10. return (
  11. <div className="error-boundary-container">
  12. <div className="icon-error-boundary-container">
  13. <Icon
  14. accessibilityLabel={`${t('generic_something_went_wrong')} ${t(
  15. 'please_refresh'
  16. )}`}
  17. type="exclamation-triangle fa-2x"
  18. fw
  19. />
  20. </div>
  21. {children || (
  22. <div className="error-message-container">
  23. <DefaultMessage className="small" style={{ fontWeight: 'bold' }} />
  24. </div>
  25. )}
  26. <Button bsStyle="primary" onClick={handleClick}>
  27. {t('refresh')}
  28. </Button>
  29. </div>
  30. )
  31. }