Added header, footer, and nav

This commit is contained in:
Andrew Scott 2022-06-04 03:18:04 -04:00
parent ff73caab92
commit 67f3a70130
Signed by: a
GPG key ID: 3EB62D0BBB8DB381

View file

@ -4,22 +4,38 @@ import { BrowserRouter as Router, Route } from "react-router-dom";
import HomePage from "./pages/HomePage"; import HomePage from "./pages/HomePage";
import CreatePage from "./pages/CreatePage"; import CreatePage from "./pages/CreatePage";
import EditPage from "./pages/EditPage"; import EditPage from "./pages/EditPage";
import { useState } from "react";
import { Link } from "react-router-dom";
function App() { function App() {
const [exerciseToEdit, setExerciseToEdit] = useState();
return ( return (
<div className="App"> <div className="App">
<Router> <Router>
<div className="App-header"> <div className="App-header">
<header>
<h1>Exercise Tracker</h1>
<p>Create, edit, and delete exercises</p>
</header>
<Route path="/" exact> <Route path="/" exact>
<HomePage /> <HomePage setExerciseToEdit={setExerciseToEdit} />
</Route> </Route>
<Route path="/create"> <Route path="/create">
<CreatePage /> <CreatePage />
</Route> </Route>
<Route path="/edit"> <Route path="/edit">
<EditPage /> <EditPage exerciseToEdit={exerciseToEdit} />
</Route> </Route>
</div> </div>
<nav>
<div>
<Link to="/">Home </Link>
</div>
<div>
<Link to="/create">Create</Link>
</div>
</nav>
<footer>© 2022 Andrew Scott</footer>
</Router> </Router>
</div> </div>
); );