Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions frontend/src/components/layout/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import React, { useState } from 'react';

export const Navbar = () => {
const [isOpen, setIsOpen] = useState(false);

const navLinks = [
{ name: 'Home', href: '/' },
{ name: 'Features', href: '#features' },
{ name: 'About', href: '#about' },
{ name: 'Contact', href: '#contact' },
];

return (
<nav className="bg-white shadow-md w-full z-50">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="flex justify-between h-16 items-center">

{/* Logo Section */}
<div className="flex-shrink-0 flex items-center">
<span className="text-2xl font-bold text-blue-600">LOGO</span>
</div>

{/* Desktop Menu */}
<div className="hidden md:flex space-x-8">
{navLinks.map((link) => (
<a
key={link.name}
href={link.href}
className="text-gray-700 hover:text-blue-600 px-3 py-2 text-sm font-medium transition-colors"
>
{link.name}
</a>
))}
</div>

{/* Hamburger Button (Mobile) */}
<div className="md:hidden flex items-center">
<button
onClick={() => setIsOpen(!isOpen)}
className="inline-flex items-center justify-center p-2 rounded-md text-gray-700 hover:text-blue-600 focus:outline-none"
aria-expanded="false"
>
<span className="sr-only">Open main menu</span>
{/* Icon changes based on menu state */}
{isOpen ? (
<svg className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
</svg>
) : (
<svg className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 6h16M4 12h16M4 18h16" />
</svg>
)}
</button>
</div>
</div>
</div>

{/* Mobile Menu (Collapsible) */}
<div className={`${isOpen ? 'block' : 'hidden'} md:hidden bg-gray-50 border-t border-gray-200`}>
<div className="px-2 pt-2 pb-3 space-y-1 sm:px-3">
{navLinks.map((link) => (
<a
key={link.name}
href={link.href}
className="block px-3 py-2 text-base font-medium text-gray-700 hover:text-blue-600 hover:bg-gray-100 rounded-md"
onClick={() => setIsOpen(false)} // Close menu on click
>
{link.name}
</a>
))}
</div>
</div>
</nav>
);
};

3 changes: 2 additions & 1 deletion frontend/src/components/layout/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { Header } from './Header'
export { Sidebar } from './Sidebar'
export { Footer } from './Footer'
export { Footer } from './Footer'
export { Navbar } from './Navbar'
Loading