Merge pull request #7 from UofCBaja/header to dev

Header merged
This commit is contained in:
darkicewolf50 2024-03-26 22:54:12 -06:00 committed by GitHub
commit 2e19a51d1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 185 additions and 97 deletions

View File

@ -1,24 +0,0 @@
import OpenPageButton from "./OpenPageButton";
/**
* @param {null} null - Takes in nothing
* @returns {JSX.Element} JSX - HTML tags and JS functionality
* @description Drop down menu elements
* @author Brock <darkicewolf50@gmail.com>
*/
const DropdownMenu = () => {
return (
<div>
<OpenPageButton
pageToGoTo={"/JoinTheClub"}
textOnButton={"Join the Club"}
/>
<OpenPageButton
pageToGoTo={"/UpcomingEvents"}
textOnButton={"Upcoming Events"}
/>
</div>
);
};
export default DropdownMenu;

View File

@ -5,6 +5,12 @@ header {
margin-top: 0%; margin-top: 0%;
} }
header a {
text-decoration: none;
color: inherit;
cursor: pointer;
}
figure { figure {
margin: 0px; margin: 0px;
height: 10%; height: 10%;
@ -19,14 +25,79 @@ header figure {
background-color: white; background-color: white;
} }
/* not sure what these two are for */ nav a {
#title { text-decoration: none;
background-color: blueviolet; color: inherit;
cursor: pointer;
} }
.banner {
nav a li {
background-color: none;
padding: 0.5rem;
border: solid 1px gray;
}
nav a li:hover {
background-color: gray;
}
nav ul {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; list-style: none;
justify-content: flex-start; margin: 0px;
background-color: aqua; padding: 0px;
}
.Hide {
display: none;
}
.DropDown {
cursor: default;
position: relative;
}
/* makes dropdown visible */
.DropDown:hover .Hide {
display: block;
position: absolute;
width: 100%;
text-align: center;
}
header div {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
header div button {
border: none;
cursor: pointer;
height: 4rem;
width: 4rem;
align-items: center;
background-color: inherit;
border: solid 2px gray;
border-radius: 1rem;
}
header div button img {
width: 100%;
}
/* for dark mode */
.darkmode {
filter: invert(95%) hue-rotate(180deg);
background-color: white;
}
#root.darkmode #logo.logoAfterDark {
filter: hue-rotate(180deg);
}
#root.darkmode #darkModeToggle {
filter: hue-rotate(180deg);
} }

View File

@ -1,8 +1,6 @@
import logo from "./logo.webp"; import logo from "./logo.webp";
import DropdownMenu from "./DropdownMenu"; import lightDark from "./light-dark.webp";
import OpenPageButton from "./OpenPageButton"; import { Outlet, Link } from "react-router-dom";
import { useNavigate, Outlet } from "react-router-dom";
import { useState } from "react";
import "./Header.css"; import "./Header.css";
import Ender from "../Footer/Ender"; import Ender from "../Footer/Ender";
@ -11,72 +9,108 @@ import Ender from "../Footer/Ender";
* @returns {JSX.Element} JSX - HTML tags and JS functionality * @returns {JSX.Element} JSX - HTML tags and JS functionality
* @description The top header part of the page includes the naviagtion * @description The top header part of the page includes the naviagtion
* @author Brock <darkicewolf50@gmail.com> * @author Brock <darkicewolf50@gmail.com>
* @todo final css add baja but eon (baja leads chat)
*/ */
const Header = () => { const Header = () => {
const [isDropdownVisible, setDropdownVisible] = useState(false);
const navigate = useNavigate();
/** /**
* @param {String} arg - The page that the button goes to * @param {null} null - Takes in nothing
* @returns {JSX.Element} JSX - HTML tags and JS functionality * @returns {CSSStyleRule} CSS - changes page to darkmode
* @description Function that move you to the specified place * @description inverts all of the colors of body without touching the pictures
* @author Brock <darkicewolf50@gmail.com> * @author Brock <darkicewolf50@gmail.com>
*/ */
const LinkTo = (arg) => { const switchDarkMode = () => {
navigate(arg); const body = document.getElementById("root");
const logoCss = document.getElementById("logo");
body.classList.toggle("darkmode");
logoCss.classList.toggle("logoAfterDark");
}; };
//makes the drop down menu visible when the mouse enters the Club Membership & Upcoming events button area /**
const handleMouseEnter = () => { * @param {null} null - Takes in nothing
setDropdownVisible(true); * @returns {CSSStyleRule} CSS - makes it compliant with bowser preferances
}; * @description checks for what the browser prefers
//makes the drop down menu invisible when the mouse leaves the Club Membership & Upcoming events button area * @author Brock <darkicewolf50@gmail.com>
const handleMouseLeave = () => { */
setDropdownVisible(false); document.addEventListener("DOMContentLoaded", () => {
}; const prefersDarkMode =
window.matchMedia &&
window.matchMedia("(prefers-color-scheme: dark)").matches;
if (prefersDarkMode) {
switchDarkMode();
}
});
return ( return (
<> <>
<header> <header>
<figure onClick={() => LinkTo("/")}> <div>
<Link to={"/"}>
<figure>
<img <img
id="logo" id="logo"
src={logo} src={logo}
alt="Schulich Off-Road's logo" alt="Schulich Off-Road's logo"
/> />
<figcaption> <figcaption>
<h2>Schulich Offroad</h2> <h1>Schulich Offroad</h1>
</figcaption> </figcaption>
</figure> </figure>
<nav> </Link>
<OpenPageButton <button onClick={switchDarkMode}>
pageToGoTo={"/"} <img
textOnButton={"About Us"} id="darkModeToggle"
src={lightDark}
alt="Light/Dark Toggle Symbol"
/> />
<OpenPageButton </button>
pageToGoTo={"/Teams"}
textOnButton={"Teams"}
/>
<OpenPageButton
pageToGoTo={"/OurSponsors"}
textOnButton={"Our Sponsors"}
/>
<div
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
style={{ background: "red" }}>
{/* dropdown menu is only visible when a mouse enters the area of the button below */}
<OpenPageButton
pageToGoTo={"/UpcomingEvents"}
textOnButton={"Club Membership & Upcoming Events"}
/>
{/*this button does nothing yet*/}
{isDropdownVisible && <DropdownMenu />}
</div> </div>
<OpenPageButton <nav>
pageToGoTo={"/Gallery"} <ul>
textOnButton={"Gallery"} <Link to={"/"}>
/> <li>About Us</li>
</Link>
<Link to={"/Teams"}>
<li>Teams</li>
</Link>
<Link to={"/OurSponsors"}>
<li>Our Sponsors</li>
</Link>
<Link to={"/OurSponsors"}>
<li>Become a Sponsor</li>
</Link>
<li className="DropDown">
{/* this link and li only exits for styling purposes */}
<Link>
<li>Club Membership & Upcoming Events</li>
</Link>
<ul className="Hide">
<Link to={"/JoinTheClub"}>
<li>Join the Club</li>
</Link>
<Link to={"/UpcomingEvents"}>
<li>Upcoming Events</li>
</Link>
<Link>
<li>Previous Events</li>
</Link>
</ul>
</li>
<li className="DropDown">
<Link>
<li>More</li>
</Link>
<ul className="Hide">
<Link>
<li>Gallery</li>
</Link>
<Link>
<li>Roster</li>
</Link>
</ul>
</li>
</ul>
</nav> </nav>
</header> </header>
<Outlet /> <Outlet />

BIN
src/Header/light-dark.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -1,13 +1,20 @@
body { body {
margin: 0; margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif; sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
code { code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
monospace; monospace;
} }
/* for dark mode */
#root.darkmode img,
#root.darkmode video,
#root.darkmode iframe {
filter: invert(95%) hue-rotate(180deg);
}