Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #89 : Add navigation back to homepage from archived task page #95

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/components/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import LOGO from "../assets/logo.png";
import { Nav } from "react-bootstrap";
import { Link } from "react-router-dom";
import { Link, useLocation } from "react-router-dom";

function Header() {
const location = useLocation();
const isArchivedPage = location.pathname === '/archive';

return (
<Nav className="pt-4 d-flex flex-column flex-md-row justify-content-center align-items-center">
{/* This item is hidden in order to make the Logo be centered horizontally */}
Expand All @@ -17,9 +20,13 @@ function Header() {
</Link>
</Nav.Item>
<Nav.Item className="nav-link m-0 px-0 pt-2 pb-0">
<Link to="/archive">
Archived Tasks
</Link>
{isArchivedPage ? (
<Link to="/">Back to Home</Link>
) : (
<Link to="/archive">
Archived Tasks
</Link>
)}
</Nav.Item>
</Nav>
);
Expand Down