2025-05-31 18:03:15 +03:30
|
|
|
'use client';
|
|
|
|
|
|
2025-06-01 17:31:43 +03:30
|
|
|
import images from '@/assets/images/images';
|
|
|
|
|
import Image from 'next/image';
|
2025-05-31 18:03:15 +03:30
|
|
|
import Link from 'next/link';
|
|
|
|
|
import { usePathname } from 'next/navigation';
|
|
|
|
|
import { useState } from 'react';
|
|
|
|
|
|
|
|
|
|
export default function Navbar() {
|
|
|
|
|
const [open, setOpen] = useState(false);
|
|
|
|
|
const pathname = usePathname();
|
|
|
|
|
|
|
|
|
|
const links = [
|
2025-06-01 17:31:43 +03:30
|
|
|
{ href: '/', label: 'Home' },
|
|
|
|
|
{ href: '/services', label: 'About US' },
|
|
|
|
|
{ href: '/blog', label: 'Products' },
|
|
|
|
|
{ href: '/contact', label: 'Blog' },
|
|
|
|
|
{ href: '/contact', label: 'Project' },
|
|
|
|
|
{ href: '/contact', label: 'Contact Us' },
|
|
|
|
|
|
2025-05-31 18:03:15 +03:30
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const linkClass = (href: string) =>
|
2025-06-01 17:31:43 +03:30
|
|
|
pathname === href ? ' text-red-500 font-semibold' : 'text-white';
|
2025-05-31 18:03:15 +03:30
|
|
|
|
|
|
|
|
return (
|
2025-06-01 17:31:43 +03:30
|
|
|
<nav className="bg-transparent container mx-auto py-11 shrink-0 relative z-10 ">
|
|
|
|
|
<div className=" flex items-center justify-between">
|
|
|
|
|
<Link href="/" className="text-xl font-bold ">
|
|
|
|
|
<Image alt='logo' src={images.logo} className='w-auto h-auto'/></Link>
|
2025-05-31 18:03:15 +03:30
|
|
|
|
|
|
|
|
<ul className="hidden md:flex space-x-6">
|
|
|
|
|
{links.map(({ href, label }) => (
|
|
|
|
|
<li key={href}>
|
|
|
|
|
<Link href={href} className={`${linkClass(href)} hover:text-primary-light `}>
|
|
|
|
|
{label}
|
|
|
|
|
</Link>
|
|
|
|
|
</li>
|
|
|
|
|
))}
|
2025-06-01 17:31:43 +03:30
|
|
|
<li>
|
|
|
|
|
<a className='flex gap-2 items-center' href='tel:+098123456789'>
|
|
|
|
|
|
|
|
|
|
<span>xx</span>
|
|
|
|
|
<p>+098 123456789</p>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
2025-05-31 18:03:15 +03:30
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
<button className="md:hidden text-gray-700" onClick={() => setOpen(!open)}>
|
|
|
|
|
{open ? <p>x</p> : <p>menu</p>}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{open && (
|
|
|
|
|
<ul className="md:hidden mt-2 space-y-2 px-2">
|
|
|
|
|
{links.map(({ href, label }) => (
|
|
|
|
|
<li key={href}>
|
|
|
|
|
<Link href={href} className={linkClass(href)} onClick={() => setOpen(false)}>
|
|
|
|
|
{label}
|
|
|
|
|
</Link>
|
|
|
|
|
</li>
|
|
|
|
|
))}
|
|
|
|
|
</ul>
|
|
|
|
|
)}
|
|
|
|
|
</nav>
|
|
|
|
|
);
|
|
|
|
|
}
|