51 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import Link from "next/link";
 | |
| import Image from "next/image";
 | |
| import React, { useState } from "react";
 | |
| import NavItem from "./NavItem"; 
 | |
| 
 | |
| const MENU_LIST = [
 | |
|   { text: "about", href: "/about" },
 | |
|   { text: "get involved", href: "/getinvolved" },
 | |
|   //{ text: "projects", href: "/projects" },
 | |
|   //{ text: "hire us", href: "/hireus" },
 | |
|   { text: "contact us", href: "/contactus" },
 | |
| ];
 | |
| const Navbar = () => {
 | |
|   const [navActive, setNavActive] = useState(null);
 | |
|   const [activeIdx, setActiveIdx] = useState(-1);
 | |
| 
 | |
|   return (
 | |
|     <header>
 | |
|       <nav className={`nav`}>
 | |
|         <Link href={"/"}>
 | |
|         <div className="flex items-center hover:fade"><Image src="/shiloh-logo-white-1.png" alt="Shiloh Logo" width={122} height={26} />
 | |
|         </div>
 | |
|         </Link>
 | |
|         <div
 | |
|           onClick={() => setNavActive(!navActive)}
 | |
|           className={`nav__menu-bar`}
 | |
|         >
 | |
|           <div></div>
 | |
|           <div></div>
 | |
|           <div></div>
 | |
|         </div>
 | |
|         <div className={`${navActive ? "active" : ""} nav__menu-list`}>
 | |
|           {MENU_LIST.map((menu, idx) => (
 | |
|             <div
 | |
|               onClick={() => {
 | |
|                 setActiveIdx(idx);
 | |
|                 setNavActive(false);
 | |
|               }}
 | |
|               key={menu.text}
 | |
|             >
 | |
|               <NavItem active={activeIdx === idx} {...menu} />
 | |
|             </div>
 | |
|           ))}
 | |
|         </div>
 | |
|       </nav>
 | |
|     </header>
 | |
|   );
 | |
| };
 | |
| 
 | |
| export default Navbar;
 |