-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from sameer550/route-added
Route added
- Loading branch information
Showing
42 changed files
with
2,124 additions
and
142 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,11 @@ | ||
import "./App.css"; | ||
import React from "react"; | ||
import "../node_modules/bootstrap/dist/css/bootstrap.min.css"; | ||
import Home from "./Features/Home"; | ||
import Login from "./Features/Login"; | ||
import { Route, Routes, Routes as Switch } from "react-router-dom"; | ||
import NewRouter from "./Features/Routes"; | ||
import { BrowserRouter } from "react-router-dom"; | ||
import Signup from "./Features/signup"; | ||
function App() { | ||
return ( | ||
<Switch> | ||
<Route exact path="/" element={<Home />} /> | ||
<Route exact path="/login" element={<Login />} /> | ||
<Route exact path="/signup" element={<Signup />} /> | ||
</Switch> | ||
); | ||
return <NewRouter />; | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from "react"; | ||
import "./style.css"; | ||
import NotFoundimg from "../../assets/img/pagenotfound.png"; | ||
|
||
const NotFound = () => { | ||
return ( | ||
<div> | ||
<img className="notFound" src={NotFoundimg} alt="PageNotFound"></img> | ||
</div> | ||
); | ||
}; | ||
|
||
export default NotFound; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.notFound { | ||
width: 100%; | ||
height: 100vh; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from "react"; | ||
import Home from "../Home"; | ||
import NotFound from "../NotFound"; | ||
import { | ||
Route, | ||
Routes as Switch, | ||
BrowserRouter, | ||
Navigate, | ||
} from "react-router-dom"; | ||
import { routeConfig } from "../Routes/routeConfig"; | ||
const NewRouter = () => { | ||
return ( | ||
<BrowserRouter> | ||
<Switch> | ||
<Route exact path="/" element={<Home />} /> | ||
<Route path="*" element={<NotFound />} /> | ||
{routeConfig.map(({ path, Component }, index) => { | ||
if (!localStorage.getItem("loginUser")) { | ||
return <Route path="/" element={<Navigate replace to="/" />} />; | ||
} | ||
return ( | ||
<Route path={path} key={index} element={<Component />}></Route> | ||
); | ||
})} | ||
</Switch> | ||
</BrowserRouter> | ||
); | ||
}; | ||
|
||
export default NewRouter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Login from "../Login"; | ||
import Signup from "../signup"; | ||
export const routeConfig = [ | ||
{ | ||
path: "login", | ||
name: "user login", | ||
Component: Login, | ||
}, | ||
{ | ||
path: "signup", | ||
name: "user signup", | ||
Component: Signup, | ||
}, | ||
]; |
Oops, something went wrong.