import logo from "./logo.png"; import lightDark from "./light-dark.webp"; import { Outlet, Link } from "react-router-dom"; import "./Header.css"; import Ender from "../Footer/Ender"; import { useState } from "react"; /** * @param {null} nothing - Takes in nothing * @returns {JSX.Element} JSX - HTML tags and JS functionality * @description The top header part of the page includes the naviagtion * @author Brock * @todo add appropriate links */ export default function Header() { const [bannerInfo, setBannerInfo] = useState({ titleText: "UCalgary Baja", subtitleText: "Hello", imgUrl: "https://picsum.photos/200", headerPostion: "absolute", }); /** * @param {null} nothing - Takes in nothing * @returns {CSSStyleRule} CSS - changes page to darkmode * @description inverts all of the colors of body without touching the pictures * @author Brock */ const switchDarkMode = () => { const body = document.getElementById("root"); const logoCss = document.getElementById("logo"); body.classList.toggle("darkmode"); logoCss.classList.toggle("logoAfterDark"); }; /** * @param {null} nothing - Takes in nothing * @returns {CSSStyleRule} CSS - makes it compliant with bowser preferances * @description checks for what the browser prefers * @author Brock */ document.addEventListener("DOMContentLoaded", () => { const prefersDarkMode = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches; if (prefersDarkMode) { switchDarkMode(); } }); return ( <>
{bannerInfo.titleText === "" && bannerInfo.imgUrl === "" ? ( <> ) : ( <>

{bannerInfo.titleText}

{bannerInfo.subtitleText === "" ? ( <> ) : (

{bannerInfo.subtitleText}

)}
)} ); } // used like this //