90 lines
4.1 KiB
JavaScript
90 lines
4.1 KiB
JavaScript
"use client";
|
|
|
|
import Link from 'next/link';
|
|
import Image from 'next/image';
|
|
import { useState } from 'react';
|
|
|
|
export default function Navbar() {
|
|
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|
|
|
const toggleMenu = () => {
|
|
setIsMenuOpen(!isMenuOpen);
|
|
};
|
|
|
|
return (
|
|
<nav className="bg-white shadow-md dark:bg-gray-900 fixed w-full z-20 top-0 left-0">
|
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
|
<div className="flex justify-between h-16">
|
|
<div className="flex items-center">
|
|
<Link href="/" className="flex-shrink-0 flex items-center">
|
|
<Image
|
|
src="/images/logo.png"
|
|
alt="YznApps Logo"
|
|
width={40}
|
|
height={40}
|
|
className="h-11 w-auto my-image"
|
|
/>
|
|
<span className="ml-2 text-xl font-bold text-gray-800 dark:text-white"></span>
|
|
</Link>
|
|
</div>
|
|
|
|
{/* Desktop menu */}
|
|
<div className="hidden md:flex items-center space-x-4">
|
|
<Link href="/" className="text-gray-700 hover:text-blue-600 dark:text-gray-300 dark:hover:text-blue-400 px-3 py-2 rounded-md text-sm font-medium">
|
|
Home
|
|
</Link>
|
|
<Link href="/services" className="text-gray-700 hover:text-blue-600 dark:text-gray-300 dark:hover:text-blue-400 px-3 py-2 rounded-md text-sm font-medium">
|
|
Services
|
|
</Link>
|
|
<Link href="/about" className="text-gray-700 hover:text-blue-600 dark:text-gray-300 dark:hover:text-blue-400 px-3 py-2 rounded-md text-sm font-medium">
|
|
About Us
|
|
</Link>
|
|
<Link href="/contact" className="text-gray-700 hover:text-blue-600 dark:text-gray-300 dark:hover:text-blue-400 px-3 py-2 rounded-md text-sm font-medium">
|
|
Contact
|
|
</Link>
|
|
</div>
|
|
|
|
{/* Mobile menu button */}
|
|
<div className="md:hidden flex items-center">
|
|
<button
|
|
onClick={toggleMenu}
|
|
type="button"
|
|
className="inline-flex items-center justify-center p-2 rounded-md text-gray-700 hover:text-blue-600 dark:text-gray-300 dark:hover:text-blue-400"
|
|
aria-controls="mobile-menu"
|
|
aria-expanded="false"
|
|
>
|
|
<span className="sr-only">Open main menu</span>
|
|
{!isMenuOpen ? (
|
|
<svg className="block h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
|
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M4 6h16M4 12h16M4 18h16" />
|
|
</svg>
|
|
) : (
|
|
<svg className="block h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
|
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M6 18L18 6M6 6l12 12" />
|
|
</svg>
|
|
)}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Mobile menu, show/hide based on menu state */}
|
|
<div className={`md:hidden ${isMenuOpen ? 'block' : 'hidden'}`} id="mobile-menu">
|
|
<div className="px-2 pt-2 pb-3 space-y-1 sm:px-3 bg-white dark:bg-gray-900 shadow-lg">
|
|
<Link href="/" className="text-gray-700 hover:text-blue-600 dark:text-gray-300 dark:hover:text-blue-400 block px-3 py-2 rounded-md text-base font-medium">
|
|
Home
|
|
</Link>
|
|
<Link href="/services" className="text-gray-700 hover:text-blue-600 dark:text-gray-300 dark:hover:text-blue-400 block px-3 py-2 rounded-md text-base font-medium">
|
|
Services
|
|
</Link>
|
|
<Link href="/about" className="text-gray-700 hover:text-blue-600 dark:text-gray-300 dark:hover:text-blue-400 block px-3 py-2 rounded-md text-base font-medium">
|
|
About Us
|
|
</Link>
|
|
<Link href="/contact" className="text-gray-700 hover:text-blue-600 dark:text-gray-300 dark:hover:text-blue-400 block px-3 py-2 rounded-md text-base font-medium">
|
|
Contact
|
|
</Link>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
);
|
|
} |