diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 8172215..e05919c 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -92,7 +92,7 @@ export default function RootLayout({ children: React.ReactNode; }>) { return ( - +
{children}
diff --git a/src/app/portfolio/page.tsx b/src/app/portfolio/page.tsx index 2e54d3a..0ebd202 100644 --- a/src/app/portfolio/page.tsx +++ b/src/app/portfolio/page.tsx @@ -68,7 +68,7 @@ export default function PortFolio() { -
+

ABOUT US

@@ -95,7 +95,7 @@ export default function PortFolio() { about-us
-
+

SERVICES

Our Services

@@ -113,7 +113,7 @@ export default function PortFolio() {
-
+

PORTFOLIO

@@ -148,7 +148,7 @@ export default function PortFolio() {
-
+
diff --git a/src/components/footer.tsx b/src/components/footer.tsx index ba77ee8..88231e3 100644 --- a/src/components/footer.tsx +++ b/src/components/footer.tsx @@ -6,7 +6,7 @@ import Image from "next/image"; export default function Footer() { return ( -
+
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 ( -
- logo - -
- {menu?.map((item) => ( - -
{item?.label}
- - ))} + <> +
+ logo + +
+ {menu?.map((item) => ( + +
{item.label}
+ + ))} +
-
+ + {open &&
setOpen(false)} />} + +
+
+ logo + +
+
+ {menu?.map((item) => ( + setOpen(false)}> +
{item.label}
+ + ))} +
+
+ ); }