|
1 | | -// import React from 'react'; |
| 1 | +// Todo: use font awesome icons or google icons |
2 | 2 | import { Link } from "react-router-dom"; |
3 | | -// import { Bars3BottomRightIcon, XMarkIcon } from "@heroicons/react/24/solid"; |
4 | | -import { useState } from "react"; |
| 3 | +import PropTypes, { string } from "prop-types"; |
5 | 4 | import Logo from "@/assets/images/logo.svg"; |
6 | 5 |
|
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 | | -function Header () { |
15 | | - const [activeLink, setActiveLink] = useState(null); |
16 | | -// const [isOpen, _ ] = useState(false); |
| 6 | +function Navbar({ links }) { |
| 7 | + // Todo: implement active link |
| 8 | + |
17 | 9 | 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 | | - |
25 | | - <Link |
26 | | - to='/' |
27 | | - className="w-7 h-7 text-white absolute right-8 top-6 cursor-pointer md:hidden" |
28 | | - > |
29 | | - {/* {isOpen ? <XMarkIcon /> : <Bars3BottomRightIcon />} */} |
30 | | - </Link> |
31 | | - |
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 `} |
34 | | - > |
35 | | - {links.map((link, index) => ( |
36 | | - <li |
37 | | - key={link.name} |
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)}>{link.name}</Link> |
41 | | - </li> |
42 | | - |
43 | | - |
44 | | - ))} |
45 | | - </ul> |
46 | | - </div> |
47 | | - </div> |
| 10 | + <nav className="shadow-md w-full flex justify-between items-center px-6 bg-secondary-dark"> |
| 11 | + <Link to="/" className="cursor-pointer"> |
| 12 | + <img src={Logo} alt="logo" className="cursor-pointer" /> |
| 13 | + </Link> |
| 14 | + |
| 15 | + <ul className="md:flex md:items-center md:pb-0 pb-12 w-full md:w-auto md:pl-0 pl-9 transition-all duration-500 ease-in"> |
| 16 | + {/* <Link to="/" className="w-7 h-7 text-white cursor-pointer md:hidden"> |
| 17 | + {isOpen ? <XMarkIcon /> : <Bars3BottomRightIcon />} |
| 18 | + </Link> */} |
| 19 | + {links.map((link) => ( |
| 20 | + <li |
| 21 | + key={link.name} |
| 22 | + className="font-semibold text-white md:my-0 md:ml-8 border-b-2 border-transparent hover:border-red-500" |
| 23 | + > |
| 24 | + <Link to={link.path}>{link.name}</Link> |
| 25 | + </li> |
| 26 | + ))} |
| 27 | + </ul> |
| 28 | + </nav> |
48 | 29 | ); |
| 30 | +} |
| 31 | + |
| 32 | +Navbar.propTypes = { |
| 33 | + links: PropTypes.arrayOf(string).isRequired, |
49 | 34 | }; |
50 | 35 |
|
51 | | -export default Header; |
| 36 | +export default Navbar; |
0 commit comments