forked from M3-Academy/desafio-react-e-typescript
removendo react router dom
estava apresentando muito bugs então será desenvolvido futuramente somente
This commit is contained in:
parent
3c89ee90bd
commit
4fed1cca0b
@ -1,21 +1,24 @@
|
||||
import React from "react";
|
||||
import { Field, ErrorMessage } from 'formik';
|
||||
|
||||
interface inputProps {
|
||||
type:string
|
||||
name?:string;
|
||||
required?:boolean
|
||||
interface classes{
|
||||
className?: string;
|
||||
Errorclass?: string;
|
||||
Labelclass?: string;
|
||||
Inputclass?: string;
|
||||
Simbolclass?: string;
|
||||
}
|
||||
|
||||
interface inputProps extends classes {
|
||||
type:string
|
||||
name?:string;
|
||||
required?:boolean
|
||||
id?: string;
|
||||
Label?: string;
|
||||
placeholder?: string;
|
||||
}
|
||||
interface checkbox extends inputProps {
|
||||
Simbol?: string;
|
||||
Simbolclass?: string;
|
||||
checked?:boolean
|
||||
onClick?: (checked:React.ChangeEvent<HTMLInputElement>) => void
|
||||
}
|
@ -4,8 +4,6 @@ import { Formik,Form, Field, FormikHelpers } from 'formik';
|
||||
import { Submenu } from "../../Modal/submenuModal";
|
||||
import {SubmenuContext} from "../../contexts/SubmenuContext";
|
||||
import {RouterContext} from "../../contexts/React_Router_context"
|
||||
import { Link, Navigate } from "react-router-dom";
|
||||
import { pathroot } from "../../pages/router/Pathrooter";
|
||||
|
||||
import HeaderStyles from "../modules/header.module.scss"
|
||||
|
||||
|
@ -1,11 +1,10 @@
|
||||
import React from "react"
|
||||
|
||||
import Institucional from "../../pages/Institucional";
|
||||
|
||||
const Main = () => {
|
||||
return (
|
||||
<main >
|
||||
<Institucional />
|
||||
<Institucional />
|
||||
</main>
|
||||
)
|
||||
};
|
||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import { Header } from './components/scripts/header';
|
||||
import { Footer } from './components/scripts/footer';
|
||||
import Routers from './pages/router/Pathrooter';
|
||||
import Main from './components/scripts/main';
|
||||
import {SubmenuProvider} from "./contexts/SubmenuContext"
|
||||
import {RouterProvider} from "./contexts/React_Router_context"
|
||||
import './components/Main.scss';
|
||||
@ -17,7 +17,7 @@ if (rootElement) {
|
||||
<SubmenuProvider>
|
||||
<Header />
|
||||
</SubmenuProvider>
|
||||
<Routers />
|
||||
<Main />
|
||||
<Footer />
|
||||
</RouterProvider>
|
||||
);
|
||||
|
@ -6,8 +6,8 @@ import Homeicon from "../components/assets/icons/home_icon.svg"
|
||||
import Leftarrow from "../components/assets/icons/Leftarrow.svg"
|
||||
import MainStyles from "../components/modules/home.module.scss"
|
||||
import FormShecma from "../schema/FormShecma";
|
||||
import { Title,BreadcrumbTitle,FormTitle } from "../components/scripts/moleculas/Title"
|
||||
import { Inputform } from "../components/scripts/moleculas/InputForm"
|
||||
import { Title,BreadcrumbTitle,FormTitle } from "../components/scripts/Células/Title"
|
||||
import { Inputform } from "../components/scripts/Células/InputForm"
|
||||
|
||||
|
||||
const title = "INSTITUCIONAL"
|
||||
|
@ -1,37 +0,0 @@
|
||||
import { BrowserRouter as Router,Routes, Route, Navigate } from 'react-router-dom';
|
||||
import Institucional from '../Institucional';
|
||||
import { RouterContext } from '../../contexts/React_Router_context';
|
||||
|
||||
interface pathtype {
|
||||
currentRoute:string
|
||||
navigate: (route: string) => void
|
||||
}
|
||||
|
||||
const pathroot = {
|
||||
Home: "/",
|
||||
Cursos:"/Cursos",
|
||||
SaibaMais:"/Saiba+&+Mais",
|
||||
Institucional:"/Institucional"
|
||||
}
|
||||
const Routers = () => {
|
||||
return(
|
||||
<RouterContext.Consumer>
|
||||
{({ currentRoute }:pathtype) => (
|
||||
<Router>
|
||||
<Routes>
|
||||
<Route path={pathroot.Home} element={currentRoute === '/' ? <Institucional /> : null} />
|
||||
<Route path={pathroot.Cursos} element={currentRoute === '/cursos' ? <div>estou no Cursos</div> : null} />
|
||||
<Route path={pathroot.SaibaMais} element={currentRoute === '/saiba+&+mais' ? <div>estou no Saiba Mais</div> : null} />
|
||||
<Route path={pathroot.Institucional} element={currentRoute === '/institucional' ? <Institucional /> : null} />
|
||||
<Route path="*" element={<Navigate to={pathroot.Home}/>}/>
|
||||
</Routes>
|
||||
</Router>
|
||||
)}
|
||||
|
||||
</RouterContext.Consumer>
|
||||
)
|
||||
}
|
||||
|
||||
export default Routers
|
||||
|
||||
export { pathroot }
|
Loading…
Reference in New Issue
Block a user