Skip to content

Commit 453ec07

Browse files
committed
fix: global bg color, navbar links refactored
1 parent eba72a3 commit 453ec07

File tree

4 files changed

+46
-49
lines changed

4 files changed

+46
-49
lines changed

src/App.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
import { HashRouter as Router, Routes, Route } from "react-router-dom";
22
import { ToastContainer } from "react-toastify";
33
import routes from "@/routes/index";
4-
import Navbar from '@/components/Navbar/index';
4+
import Navbar from "@/components/Navbar/index";
5+
6+
const navLinks = [
7+
{ name: "About Us", path: "/about-us" },
8+
{ name: "Our Team", path: "/teams" },
9+
{ name: "Gallery", path: "/gallery" },
10+
{ name: "Contact", path: "/contact-us" },
11+
{ name: "Projects", path: "/projects" },
12+
];
513

614
function App() {
715
return (
816
<Router>
9-
<Navbar/>
17+
<Navbar links={navLinks} />
1018
<ToastContainer />
1119
<Routes>
1220
{routes.map((route) => (

src/assets/styles/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
font-family: "poppins", "sans-serif";
1414
}
1515

16+
body {
17+
background-color: theme("colors.secondary.light");
18+
}
19+
1620
a {
1721
text-decoration: none;
1822
color: inherit;

src/components/Navbar/index.jsx

Lines changed: 29 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,36 @@
1-
// import React from 'react';
1+
// Todo: use font awesome icons or google icons
22
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";
54
import Logo from "@/assets/images/logo.svg";
65

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+
179
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>
4829
);
30+
}
31+
32+
Navbar.propTypes = {
33+
links: PropTypes.arrayOf(string).isRequired,
4934
};
5035

51-
export default Header;
36+
export default Navbar;

tailwind.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ export default {
2222
text: {
2323
light: "#F7F7F7",
2424
dark: "#232323",
25-
},
25+
},
2626
gradient: {
2727
light: "#383838",
2828
dark: "#222222 ",
29-
}
29+
},
3030
},
3131
screens: {
3232
xs: "0px",
@@ -37,7 +37,7 @@ export default {
3737
},
3838
fontFamily: {
3939
poppins: ["Poppins", "sans-serif"],
40-
gothic: ["League Gothic", "sans-serif"]
40+
gothic: ["League Gothic", "sans-serif"],
4141
},
4242
},
4343
},

0 commit comments

Comments
 (0)