Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 83 additions & 21 deletions src/app/components/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"use client";
import { motion } from "motion/react";
import { motion, AnimatePresence } from "motion/react";
import { Link as ScrollLink } from "react-scroll";
import Link from "next/link";
import { useState, useEffect } from "react";
import { FaBars, FaTimes } from "react-icons/fa";

import navbarItems from "@/data/NavbarData";

Expand Down Expand Up @@ -42,28 +43,89 @@ const use10vhAsPixels = () => {
const Navbar = () => {
const pixels = use10vhAsPixels();

const [isOpen, setIsOpen] = useState(false);

const toggleMenu = () => setIsOpen((prev) => !prev);

return (
<div className="fixed left-0 top-0 z-50 flex h-[10vh] w-full cursor-pointer justify-evenly bg-white px-8 shadow-xl">
<div className="flex w-1/2 flex-row items-center gap-4 text-left">
<Link href="/">
<p className="font-bold">Kevin Loritsch</p>
</Link>
</div>
<div className="flex w-1/2 flex-row items-center justify-end text-right">
{navbarItems.map(({ name, link }, i) => (
<motion.div {...fadeIn(i / 5)} key={i}>
<motion.div className="pr-4" {...hoverAnimation}>
<ScrollLink
to={link}
smooth={true}
offset={-pixels}
duration={500}
>
{name}
</ScrollLink>
<div>
<div className="fixed left-0 top-0 z-50 hidden h-[10vh] w-full cursor-pointer justify-evenly bg-white px-8 shadow-xl md:flex">
<div className="flex w-1/2 flex-row items-center gap-4 text-left">
<Link href="/">
<p className="font-bold">Kevin Loritsch</p>
</Link>
</div>
<div className="flex w-1/2 flex-row items-center justify-end text-right">
{navbarItems.map(({ name, link }, i) => (
<motion.div {...fadeIn(i / 5)} key={i}>
<motion.div className="pr-4" {...hoverAnimation}>
<ScrollLink
to={link}
smooth={true}
offset={-pixels}
duration={500}
>
{name}
</ScrollLink>
</motion.div>
</motion.div>
</motion.div>
))}
))}
</div>
</div>
<div className="fixed left-0 top-0 z-50 w-full bg-white shadow-md md:hidden">
<div className="flex items-center justify-between px-4 py-3">
<Link href="/" className="text-2xl font-bold">
Kevin Loritsch
</Link>
<button onClick={toggleMenu} className="text-3xl">
<AnimatePresence mode="wait" initial={false}>
{isOpen ? (
<motion.div
key="close"
initial={{ rotate: -90, opacity: 0 }}
animate={{ rotate: 0, opacity: 1 }}
exit={{ rotate: 90, opacity: 0 }}
transition={{ duration: 0.3 }}
>
<FaTimes />
</motion.div>
) : (
<motion.div
key="open"
initial={{ rotate: 90, opacity: 0 }}
animate={{ rotate: 0, opacity: 1 }}
exit={{ rotate: -90, opacity: 0 }}
transition={{ duration: 0.3 }}
>
<FaBars />
</motion.div>
)}
</AnimatePresence>
</button>
</div>

<div
className={`overflow-hidden bg-white transition-all duration-300 ${
isOpen ? "max-h-96 opacity-100" : "max-h-0 opacity-0"
}`}
>
<div className="mx-2 flex flex-col items-center gap-6 border-t-2 py-4 text-xl">
{navbarItems.map(({ name, link }, i) => (
<motion.div {...fadeIn(i / 5)} key={i}>
<motion.div className="pr-4" {...hoverAnimation}>
<ScrollLink
to={link}
smooth={true}
offset={-pixels}
duration={500}
>
{name}
</ScrollLink>
</motion.div>
</motion.div>
))}
</div>
</div>
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const Project = ({
</motion.div>

<motion.div
className="absolute inset-0 flex items-center justify-center rounded-2xl bg-black/70 p-6 text-center"
className="absolute inset-0 flex select-none items-center justify-center rounded-2xl bg-black/70 p-6 text-center"
style={{ backdropFilter: "blur(6px)" }}
initial={{ opacity: 0 }}
whileHover={{ opacity: 1 }}
Expand Down
Loading