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.

App.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import React, { useEffect } from 'react'
  2. import './App.css'
  3. import { Switch, Route, useHistory } from 'react-router-dom'
  4. import { ThemeProvider, createMuiTheme } from '@material-ui/core'
  5. import { red, teal } from '@material-ui/core/colors'
  6. import Inicio from './Screens/Inicio'
  7. import Formulario from './Screens/Formulario'
  8. function App() {
  9. const history = useHistory()
  10. const estado = localStorage.getItem('estado')
  11. useEffect(
  12. () => {
  13. if (estado === 'pendiente') history.push('/pendiente')
  14. if (estado === 'finalizado') history.push('/finalizado')
  15. },
  16. [ estado, history ]
  17. )
  18. const primaryColor = teal[300]
  19. const secondaryColor = red[300]
  20. const theme = createMuiTheme({
  21. palette: {
  22. type: 'dark',
  23. primary: { main: primaryColor },
  24. secondary: { main: secondaryColor },
  25. background: {
  26. default: '#121212',
  27. level1: '#212121',
  28. level2: '#212121',
  29. paper: '#424242'
  30. }
  31. },
  32. props: {
  33. MuiPaper: {
  34. variant: 'outlined'
  35. },
  36. MuiButton: {
  37. variant: 'contained',
  38. disableElevation: true,
  39. style: {textTransform: 'none'}
  40. }
  41. }
  42. })
  43. return (
  44. <ThemeProvider theme={theme}>
  45. <Switch>
  46. <Route path='/formulario'>
  47. <Formulario/>
  48. </Route>
  49. <Route path='/'>
  50. <Inicio />
  51. </Route>
  52. </Switch>
  53. </ThemeProvider>
  54. )
  55. }
  56. export default App