Skip to content

Commit a02554f

Browse files
committed
feat: refactor Navbar component to use dynamic navigation links and button properties for improved maintainability
1 parent 069f1eb commit a02554f

File tree

1 file changed

+25
-29
lines changed

1 file changed

+25
-29
lines changed

src/app/_components/navbar.tsx

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,42 +11,42 @@ import Button from './button';
1111
const Navbar: React.FC = () => {
1212
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
1313

14+
const navLinks = [
15+
{ href: "/", text: "Home" },
16+
{ href: "/ctfs", text: "CTF's" },
17+
{ href: "/repositories", text: "Repositories" },
18+
{ href: "/indonesia-ctf-2025", text: "INDONESIA CTF 2025" },
19+
{ href: "/mobile-ctf-2025", text: "Mobile CTF 2025" },
20+
];
21+
22+
const buttonProps = {
23+
text: 'Join Playground',
24+
href: 'https://playground.tcp1p.team/',
25+
};
26+
1427
return (
1528
<nav className="fixed top-0 left-0 right-0 bg-gray-900/80 backdrop-blur-lg border-b border-red-500/10 z-50">
1629
<div className="max-w-7xl mx-auto">
1730
<div className="flex items-center justify-between h-16 px-4 sm:px-6 lg:px-8">
1831
<div className="flex-shrink-0">
1932
<div className="flex items-center space-x-2">
20-
<Image src={logo} alt={"TCP1P Logo"} width={120}></Image>
33+
<Image src={logo} alt={"TCP1P Logo"} width={120}></Image>
2134
</div>
2235
</div>
2336

2437
<div className="hidden md:flex items-center justify-center space-x-8">
25-
<Link href="/" className="nav-item text-gray-300 hover:text-red-400 transition-colors duration-300">
26-
Home
27-
</Link>
28-
<Link href="/ctfs" className="nav-item text-gray-300 hover:text-red-400 transition-colors duration-300">
29-
CTF&apos;s
30-
</Link>
31-
<Link href="/repositories" className="nav-item text-gray-300 hover:text-red-400 transition-colors duration-300">
32-
Repositories
33-
</Link>
34-
<Link href="/indonesia-ctf-2025" className="nav-item text-gray-300 hover:text-red-400 transition-colors duration-300">
35-
INDONESIA CTF 2025
36-
</Link>
37-
<Link href="/mobile-ctf-2025" className="nav-item text-gray-300 hover:text-red-400 transition-colors duration-300">
38-
Mobile CTF 2025
39-
</Link>
38+
{navLinks.map((link, index) => (
39+
<Link key={index} href={link.href} className="nav-item text-gray-300 hover:text-red-400 transition-colors duration-300">
40+
{link.text}
41+
</Link>
42+
))}
4043
</div>
4144

4245
<div className="hidden md:block">
43-
<Button text='Join Playground' href='https://playground.tcp1p.team/' target='_blank'></Button>
46+
<Button text={buttonProps.text} href={buttonProps.href} target='_blank'></Button>
4447
</div>
4548

4649
<div className="md:hidden flex items-center space-x-4">
47-
{/* <button className="px-4 py-1.5 bg-gradient-to-r from-red-600 to-red-500 text-white text-sm rounded-full font-medium hover:from-red-500 hover:to-red-400 transition-all duration-300 shadow-lg shadow-red-500/30">
48-
Get Started
49-
</button> */}
5050
<button
5151
onClick={() => setIsMobileMenuOpen(!isMobileMenuOpen)}
5252
className="mobile-menu-button p-2 rounded-md text-red-300 hover:bg-red-900/30"
@@ -57,15 +57,11 @@ const Navbar: React.FC = () => {
5757
</div>
5858

5959
<div className={`mobile-menu md:hidden px-4 pb-4 ${isMobileMenuOpen ? '' : 'hidden'}`}>
60-
<Link href="/" className="block px-4 py-2 text-gray-300 hover:text-red-400 transition-colors duration-300">
61-
Home
62-
</Link>
63-
<Link href="/ctfs" className="block px-4 py-2 text-gray-300 hover:text-red-400 transition-colors duration-300">
64-
CTF&apos;s
65-
</Link>
66-
<Link href="/repositories" className="block px-4 py-2 text-gray-300 hover:text-red-400 transition-colors duration-300">
67-
Repositories
68-
</Link>
60+
{navLinks.map((link, index) => (
61+
<Link key={index} href={link.href} className="block px-4 py-2 text-gray-300 hover:text-red-400 transition-colors duration-300">
62+
{link.text}
63+
</Link>
64+
))}
6965
</div>
7066
</div>
7167
</nav>

0 commit comments

Comments
 (0)