Skip to content

Commit

Permalink
fix: updated nav bar to use NavLink component
Browse files Browse the repository at this point in the history
Co-authored-by: Maha Ahmed <[email protected]>
  • Loading branch information
bbland1 and eternalmaha committed Aug 14, 2024
1 parent e79843a commit 07c5a8f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/views/Layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@

.Nav-link {
--color-text: var(--color-accent);

color: var(--color-text);
font-size: 1.4em;
flex: 0 1 auto;
Expand Down
29 changes: 22 additions & 7 deletions src/views/Layout.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Outlet } from 'react-router-dom';
import { Outlet, NavLink } from 'react-router-dom';
import { useAuth, SignInButton, SignOutButton } from '../api/useAuth';

import './Layout.css';
Expand Down Expand Up @@ -26,15 +26,30 @@ export function Layout() {
<nav className="Nav">
<div className="Nav-container">
{!!user ? <SignOutButton /> : <SignInButton />}
<button href="#" className="Nav-link">
<NavLink
to="/"
className={({ isActive, isPending, isTransitioning }) =>
`Nav-link ${isPending ? 'pending' : ''} ${isActive ? 'active' : ''} ${isTransitioning ? 'transitioning' : ''}`
}
>
Home
</button>
<button href="#" className="Nav-link">
</NavLink>
<NavLink
to="/list"
className={({ isActive, isPending, isTransitioning }) =>
`Nav-link ${isPending ? 'pending' : ''} ${isActive ? 'active' : ''} ${isTransitioning ? 'transitioning' : ''}`
}
>
List
</button>
<button href="#" className="Nav-link">
</NavLink>
<NavLink
to="/manage-list"
className={({ isActive, isPending, isTransitioning }) =>
`Nav-link ${isPending ? 'pending' : ''} ${isActive ? 'active' : ''} ${isTransitioning ? 'transitioning' : ''}`
}
>
Manage List
</button>
</NavLink>
</div>
</nav>
</div>
Expand Down

0 comments on commit 07c5a8f

Please sign in to comment.