diff --git a/src/components/navbar.tsx b/src/components/navbar.tsx
index bd23b50..9886423 100644
--- a/src/components/navbar.tsx
+++ b/src/components/navbar.tsx
@@ -1,32 +1,70 @@
"use client";
import Image from "next/image";
import Logo from "@/image/Logo.svg";
-import { ListIcon } from "@phosphor-icons/react/dist/ssr";
+import { ListIcon, XIcon } from "@phosphor-icons/react/dist/ssr";
import Link from "next/link";
-import { usePathname } from "next/navigation";
+import { useState, useEffect } from "react";
export default function Navbar() {
- const pathname = usePathname();
+ const [open, setOpen] = useState(false);
+ const [active, setActive] = useState("about-us");
const menu = [
- { label: "About Us", url: "/" },
- { label: "Services", url: "/" },
- { label: "Portfolio", url: "/portfolio" },
- { label: "Process", url: "/" },
- { label: "Kontak", url: "/" },
+ { label: "About Us", url: "/portfolio#about-us", id: "about-us" },
+ { label: "Services", url: "/portfolio#services", id: "services" },
+ { label: "Portfolio", url: "/portfolio#portfolio", id: "portfolio" },
+ { label: "Process", url: "/portfolio#process", id: "process" },
+ { label: "Kontak", url: "/portfolio#kontak", id: "kontak" },
];
+ useEffect(() => {
+ const ids = ["about-us", "services", "portfolio", "process", "kontak"];
+ const sections = ids.map((id) => document.getElementById(id)).filter(Boolean) as HTMLElement[];
+ const observer = new IntersectionObserver(
+ (entries) => {
+ entries.forEach((entry) => {
+ if (entry.isIntersecting) setActive(entry.target.id);
+ });
+ },
+ { rootMargin: "-50% 0px -50% 0px" }
+ );
+ sections.forEach((section) => observer.observe(section));
+ return () => observer.disconnect();
+ }, []);
+
return (
-
-
-
-
- {menu?.map((item) => (
-
-
{item?.label}
-
- ))}
+ <>
+
+
+
+
+ {menu?.map((item) => (
+
+
{item.label}
+
+ ))}
+
-
+
+ {open &&
setOpen(false)} />}
+
+
+
+
+
+
+
+ {menu?.map((item) => (
+
setOpen(false)}>
+
{item.label}
+
+ ))}
+
+
+ >
);
}