Skip to content

Commit 037e71a

Browse files
committed
modify navbar site list
1 parent e0fd4b0 commit 037e71a

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

app/components/Navbar.tsx

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,28 @@ import DevshLogo from "@/public/devsh_transparent_1920.png"
66
import { ReactNode, useState } from "react"
77
import { motion } from "framer-motion"
88

9+
type Link = {
10+
name: string,
11+
url: string
12+
}
13+
14+
const links: Link[] = [
15+
{ name: "Home", url: "/" },
16+
{ name: "Nabla", url: "/nabla" },
17+
{ name: "Blog", url: "/blog" },
18+
{ name: "About", url: "/about" },
19+
{ name: "Services", url: "/services" },
20+
{ name: "Contact", url: "/contact" }
21+
]
22+
23+
function DropdownIcon() {
24+
return (
25+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="size-6">
26+
<path strokeLinecap="round" strokeLinejoin="round" d="M3.75 5.25h16.5m-16.5 4.5h16.5m-16.5 4.5h16.5m-16.5 4.5h16.5" />
27+
</svg>
28+
)
29+
}
30+
931
function NavbarLink({children, href, onClick}: {children: ReactNode, href: string, onClick?: () => void}) {
1032
return (
1133
<li className="transition-colors duration-300 text-md text-neutral-400 hover:text-neutral-300">
@@ -25,14 +47,10 @@ export default function Navbar() {
2547
<span className="text-md sm:text-2xl">DevSH Graphics Programming</span>
2648
</Link>
2749
<ul className="hidden sm:flex grow-0 flex-row gap-2">
28-
<NavbarLink href="/">Home</NavbarLink>
29-
<NavbarLink href="/nabla">Nabla</NavbarLink>
30-
<NavbarLink href="/blog">Blog</NavbarLink>
50+
{links.map((link, index) => <NavbarLink href={link.url} key={index}>{link.name}</NavbarLink>)}
3151
</ul>
3252
<button className={`transition-transform duration-300 sm:hidden ${isDropdownEnabled ? "rotate-180" : "rotate-0"}`} onClick={() => setIsDropdownEnabled(!isDropdownEnabled)}>
33-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="size-6">
34-
<path strokeLinecap="round" strokeLinejoin="round" d="M3.75 5.25h16.5m-16.5 4.5h16.5m-16.5 4.5h16.5m-16.5 4.5h16.5" />
35-
</svg>
53+
<DropdownIcon/>
3654
</button>
3755
</div>
3856
{isDropdownEnabled && (
@@ -43,9 +61,7 @@ export default function Navbar() {
4361
transition={{ duration: 0.5 }}
4462
className="flex flex-col w-full py-4 text-center sm:hidden bg-black border-b border-[#181818] gap-1"
4563
>
46-
<NavbarLink href="/" onClick={() => setIsDropdownEnabled(false)}>Home</NavbarLink>
47-
<NavbarLink href="/nabla" onClick={() => setIsDropdownEnabled(false)}>Nabla</NavbarLink>
48-
<NavbarLink href="/blog" onClick={() => setIsDropdownEnabled(false)}>Blog</NavbarLink>
64+
{links.map((link, index) => <NavbarLink href={link.url} key={index}>{link.name}</NavbarLink>)}
4965
</motion.ul>
5066
)}
5167
</nav>

0 commit comments

Comments
 (0)