layout.tsx 945 B

12345678910111213141516171819202122232425262728293031
  1. import Icon from '../../../../../shared/components/icon'
  2. import { UseAsyncReturnType } from '../../../../../shared/hooks/use-async'
  3. import { getUserFacingMessage } from '../../../../../infrastructure/fetch-json'
  4. import OLRow from '@/features/ui/components/ol/ol-row'
  5. import OLNotification from '@/features/ui/components/ol/ol-notification'
  6. type LayoutProps = {
  7. children: React.ReactNode
  8. isError: UseAsyncReturnType['isError']
  9. error: UseAsyncReturnType['error']
  10. }
  11. function Layout({ isError, error, children }: LayoutProps) {
  12. return (
  13. <div className="affiliations-table-row-highlighted">
  14. <OLRow>{children}</OLRow>
  15. {isError && (
  16. <OLNotification
  17. type="error"
  18. content={getUserFacingMessage(error) ?? ''}
  19. bs3Props={{
  20. icon: <Icon type="exclamation-triangle" fw />,
  21. className: 'text-center',
  22. }}
  23. />
  24. )}
  25. </div>
  26. )
  27. }
  28. export default Layout