|
| 1 | +// import React from 'react'; |
| 2 | +import { Bars3BottomRightIcon, XMarkIcon } from "@heroicons/react/24/solid"; |
| 3 | +import { useState } from "react"; |
| 4 | +import Logo from "@/assets/images/logo.svg"; |
| 5 | +import { Link } from "react-router-dom"; |
| 6 | + |
| 7 | +const links = [ |
| 8 | + { name: "About Us", path: "#" }, |
| 9 | + { name: "Our Team", path: "#" }, |
| 10 | + { name: "Gallery", path: "#" }, |
| 11 | + { name: "Contact", path: "#" }, |
| 12 | + { name: "Projects", path: "#" }, |
| 13 | +]; |
| 14 | +const Header = () => { |
| 15 | + const [activeLink, setActiveLink] = useState(null); |
| 16 | + const [isOpen, setisOpen] = useState(false); |
| 17 | + return ( |
| 18 | + <div className="shadow-md w-full fixed top-0 left-0"> |
| 19 | + <div className="md:px-10 py-4 px-7 md:flex justify-between items-center bg-black "> |
| 20 | + <div className="flex text-2x1 cursor-pointer items-center gap-2"> |
| 21 | + {/* <logo/> */} |
| 22 | + <img src={Logo} alt="logo" className="w-22 h-22" /> |
| 23 | + </div> |
| 24 | + {/*Menu*/} |
| 25 | + <div |
| 26 | + onClick={() => setisOpen(!isOpen)} |
| 27 | + className="w-7 h-7 text-white absolute right-8 top-6 cursor-pointer md:hidden" |
| 28 | + > |
| 29 | + {isOpen ? <XMarkIcon /> : <Bars3BottomRightIcon />} |
| 30 | + </div> |
| 31 | + {/*links*/} |
| 32 | + <ul |
| 33 | + className={`md:flex md:items-center md:pb-0 pb-12 absolute md:static md:z-auto z-[-1] left-0 w-full md:w-auto md:pl-0 pl-9 transition-all duration-500 ease-in ${isOpen ? "top-12" : "top-[-490px]"}`} |
| 34 | + > |
| 35 | + {links.map((link, index) => ( |
| 36 | + // <li |
| 37 | + // key={index} |
| 38 | + // className={`font-semibold my-7 md:my-0 md:ml-8 ${activeLink === index ? "hover:border-b-2 border-red-500" : ""}`} |
| 39 | + // > |
| 40 | + // <Link to={link.path} className="hover:border-b-2 border-white transition-all duration-300 ease-in-out" onClick={() => setActiveLink(index)}>{name}</Link> |
| 41 | + // </li> |
| 42 | + <li>links</li> |
| 43 | + |
| 44 | + ))} |
| 45 | + </ul> |
| 46 | + </div> |
| 47 | + </div> |
| 48 | + ); |
| 49 | +}; |
| 50 | + |
| 51 | +export default Header; |
0 commit comments