diff --git a/components/custom/navbar.tsx b/components/custom/navbar.tsx index 4ca4754..5048bf0 100644 --- a/components/custom/navbar.tsx +++ b/components/custom/navbar.tsx @@ -1,14 +1,24 @@ "use client" -import { useEffect, useState } from "react" +import { Fragment, useEffect, useState } from "react" import Link from "next/link" import { cn } from "@/lib/utils" import { ThemeSwitch } from "./theme-switch" import { useTranslations } from "next-intl" import { LocaleSwitch } from "./locale-switch" +import { Button } from "@/components/ui/button" +import { Menu, X } from "lucide-react" +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu" export default function Navbar() { const [scrolled, setScrolled] = useState(false); + const [mobileMenuOpen, setMobileMenuOpen] = useState(false); const t = useTranslations('pages'); useEffect(() => { @@ -20,47 +30,95 @@ export default function Navbar() { return () => window.removeEventListener("scroll", onScroll) }, []) + useEffect(() => { + const mediaQueryList = window.matchMedia("(min-width: 768px)"); + + const onChange = (event: MediaQueryListEvent) => { + if (event.matches) setMobileMenuOpen(false); + }; + + mediaQueryList.addEventListener("change", onChange); + return () => mediaQueryList.removeEventListener("change", onChange); + }, []); + + const navLinks = [ + { href: "/", label: t("home") }, + { href: "/about", label: t("aboutMe") }, + { href: "/projects", label: t("projects") }, + ]; + return ( -
+
) -} \ No newline at end of file +}