summaryrefslogtreecommitdiff
path: root/components/header.tsx
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-10-13 00:38:37 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-10-13 00:38:37 +0800
commit433e08f2f798b4c04d57cd2d61b16a58aa5196be (patch)
tree699df47962e2fc921c9ddde8a034f41af92b3c63 /components/header.tsx
parent308eb96365a7cee0ebc8118673c3b6c85497ce3e (diff)
core: added home page
Diffstat (limited to 'components/header.tsx')
-rw-r--r--components/header.tsx39
1 files changed, 39 insertions, 0 deletions
diff --git a/components/header.tsx b/components/header.tsx
new file mode 100644
index 0000000..5b850e2
--- /dev/null
+++ b/components/header.tsx
@@ -0,0 +1,39 @@
+"use client"
+
+import Link from "next/link"
+import { usePathname } from "next/navigation"
+import { cn } from "@/lib/utils"
+import { useEffect, useState } from 'react';
+import "./header.css"
+
+
+export default function Header() {
+ const pathname = usePathname()
+ const [isMinimized, setIsMinimized] = useState(false);
+
+ useEffect(() => {
+ const handleScroll = () => {
+ setIsMinimized(window.scrollY > 100);
+ };
+
+ window.addEventListener('scroll', handleScroll);
+
+ return () => {
+ window.removeEventListener('scroll', handleScroll);
+ };
+ }, []);
+
+ return (
+ <header id="navBarHeader" className={isMinimized ? "minimizedIsland" : ""}>
+ <nav className="navBar">
+ <div className="hleft">
+ <Link id="btnHome" className={pathname === "/" ? "active": ""} style={{ textDecoration: 'unset' }} href="/">Home</Link>
+ </div>
+ <div className="hright">
+ <Link id="btnAbout" className={pathname === "/about" ? "active": ""} style={{ textDecoration: 'unset' }} href="/about">About</Link>
+ <Link id="btnGhRepo" className={pathname === "/ghrepos" ? "active": ""} style={{ textDecoration: 'unset' }} href="/ghrepos">Github Repos</Link>
+ </div>
+ </nav>
+ </header>
+ )
+} \ No newline at end of file