Skip to content

Commit

Permalink
Merge pull request #115 from Spiderpig02/develop
Browse files Browse the repository at this point in the history
fix: 💄 Fix styling of Navbar so that it is visible even when scrolling down on the AboutUs-page
  • Loading branch information
jmnorheim authored Sep 19, 2024
2 parents 810a9d4 + 212a7af commit 9185871
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 4 additions & 1 deletion frontend/src/components/navbar/Navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
justify-content: flex-start;
padding: 0.7rem;
z-index: 1000;
}

/* background-color: red; */
.navbar-solid {
background-image: linear-gradient(to right, #05445e, #581c87, #05445e); /* Gradient background */
transition: background-color 0.3s ease-in-out;
}

.navbar-logo {
Expand Down
13 changes: 11 additions & 2 deletions frontend/src/components/navbar/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import React from "react";
import React, { useState, useEffect } from "react";
import { Link, useLocation } from "react-router-dom";
import "./Navbar.css";

const Navbar: React.FC = () => {
const location = useLocation();
const [shouldHaveSolidColour, setShouldHaveSolidColour] = useState(false);

useEffect(() => {
if (location.pathname === "/about-us") {
setShouldHaveSolidColour(true);
} else {
setShouldHaveSolidColour(false);
}
}, [location.pathname]);

return (
<nav className="navbar">
<nav className={`navbar ${shouldHaveSolidColour ? "navbar-solid" : ""}`}>
<div className="navbar-logo" onClick={() => (window.location.href = "/")}>
GalacticPathFinder
</div>
Expand Down

0 comments on commit 9185871

Please sign in to comment.