You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TheContent.js 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import React, { Suspense } from 'react'
  2. import {
  3. Redirect,
  4. Route,
  5. Switch
  6. } from 'react-router-dom'
  7. import { CContainer, CFade } from '@coreui/react'
  8. // routes config
  9. import routes from '../routes'
  10. const loading = (
  11. <div className="pt-3 text-center">
  12. <div className="sk-spinner sk-spinner-pulse"></div>
  13. </div>
  14. )
  15. const TheContent = () => {
  16. return (
  17. <main className="c-main">
  18. <CContainer fluid>
  19. <Suspense fallback={loading}>
  20. <Switch>
  21. {routes.map((route, idx) => {
  22. return route.component && (
  23. <Route
  24. key={idx}
  25. path={route.path}
  26. exact={route.exact}
  27. name={route.name}
  28. render={props => (
  29. <CFade>
  30. {/* <CFade code="br-root"> */}
  31. <route.component {...props} />
  32. </CFade>
  33. )} />
  34. )
  35. })}
  36. <Redirect from="/" to="/dashboard" />
  37. </Switch>
  38. </Suspense>
  39. </CContainer>
  40. </main>
  41. )
  42. }
  43. export default React.memo(TheContent)