portfolio/src/components/Header.jsx

60 lines
1.6 KiB
React
Raw Normal View History

2023-10-12 09:56:13 +02:00
import { Link, useLocation } from "react-router-dom";
2022-07-27 18:34:46 +02:00
import { Turn as Hamburger } from "hamburger-react";
import { useState } from "react";
2022-07-27 16:36:16 +02:00
2022-07-27 13:42:38 +02:00
function Header() {
2022-07-27 18:34:46 +02:00
const [isOpen, setOpen] = useState(false);
2022-07-27 19:26:06 +02:00
const menuTimeout = 400;
2023-10-12 09:56:13 +02:00
const location = useLocation();
2022-07-27 18:34:46 +02:00
2023-10-12 09:56:13 +02:00
const menu = [
{ link: "/", title: ".me()" },
{ link: "/experience", title: ".experience()" },
{ link: "/contact", title: ".contact()" },
];
const menuUI = menu.map((item) => {
let className = "drop-shadow-light hover:drop-shadow-doublelight";
if (location.pathname === item.link) {
className += " text-white";
} else {
className += " text-white/40";
}
return (
<li key={item.link}>
<Link className={className} to={item.link}>
{item.title}
2022-07-27 19:26:06 +02:00
</Link>
2023-10-12 09:56:13 +02:00
</li>
);
});
2022-07-27 18:34:46 +02:00
2022-07-27 16:36:16 +02:00
return (
2023-10-12 09:56:13 +02:00
<header className="sticky top-0 z-50 backdrop-blur-sm bg-bgColor/90 ">
<div className="container mx-auto">
<nav className="flex items-center mx-4 py-4">
<div className="flex-none text-4xl font-black">
<Link
className=" drop-shadow-doublelight hover:drop-shadow-light"
to="/"
>
MS.
</Link>
2022-07-27 16:36:16 +02:00
</div>
2023-10-12 09:56:13 +02:00
{/* <div className="hamburger">
2022-07-27 19:26:06 +02:00
<Hamburger color="#e5e5ff" toggled={isOpen} toggle={setOpen} />
2023-10-12 09:56:13 +02:00
</div> */}
<div className="grow"></div>
<div className="flex-none ">
<ul className="flex flex-row gap-4 text-lg">{menuUI}</ul>
2022-07-27 16:36:16 +02:00
</div>
2023-10-12 09:56:13 +02:00
</nav>
2022-07-27 18:34:46 +02:00
{isOpen && hamburgerMenu}
2022-07-27 16:36:16 +02:00
</div>
2023-10-12 09:56:13 +02:00
</header>
2022-07-27 16:36:16 +02:00
);
2022-07-27 13:42:38 +02:00
}
export default Header;