Skip to content

Commit

Permalink
Merge pull request #97 from iamendless10/main
Browse files Browse the repository at this point in the history
New Header Component
  • Loading branch information
skmirajulislam authored Oct 6, 2024
2 parents ae297c7 + b4f7b29 commit b99abdc
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 202 deletions.
5 changes: 5 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"bootstrap": "^5.3.3",
"browserify-zlib": "^0.2.0",
"cors": "^2.8.5",
"enyan": "file:",
"express": "^4.21.0",
"firebase": "^10.14.0",
"gh-pages": "^6.1.1",
Expand Down
199 changes: 30 additions & 169 deletions frontend/src/components/Navbar/Navbar.css
Original file line number Diff line number Diff line change
@@ -1,195 +1,56 @@
/* General styling for the navbar */
.navbar {
background-color: #ffffff;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
padding: 0;
position: relative;
background-color: #fff; /* Navbar background */
padding: 20px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
border-radius: 40px; /* Rounded corners */
position: fixed;
top: 20px; /* To give the floating effect */
left: 50%;
transform: translateX(-50%);
width: 80%; /* Adjust width */
z-index: 1000; /* Stay on top */
}

.container {
/* Flexbox for the content of the navbar */
.navbar-container {
display: flex;
justify-content: space-between;
align-items: center;
height: 60px;
padding: 0;
}

.themechangebtn{
background-color: #fff;
}

.themechangebtn:hover{
background-color: #fff;
}

.themechangebtn img{
height:25px;
width: 25px;
background-color: none;
}

.dark-mode .navbar {
background-color: #333;
color: #fff;
}

.dark-mode .nav-links a {
color: #fff;
width: 100%;
}

.dark-mode .nav-links a:hover {
color: #ccc;
}

.dark-mode .logo {
filter: invert(1);
}

.theme-button {
background-color: #333;
color: #fff;
border: none;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
}

.theme-button:hover {
background-color: #444;
}


.logo {
height: 40px;
/* Logo on the left */
.logo img {
height: 50px; /* Adjust size of logo */
}

/* Align the navigation links to the right */
.nav-links {
display: flex;
list-style: none;
margin: 0;
padding: 0;
align-items: centre;
margin-left: auto; /* Push the links to the right */
}

.nav-links li {
margin: 0 20px;
margin-left: 20px; /* Space between each link */
}

.nav-links a {
text-decoration: none;
color: #4a5568;
font-size: 16px;
font-weight: 500;
transition: color 0.3s ease, background-color 0.3s ease;
padding: 8px 12px;
border-radius: 4px;
margin: 0;
display: flex;
align-items: center;
font-family: "Montserrat", sans-serif;
font-size: 17px;
font-weight: 600;
color: #333;
padding: 10px 15px; /* Padding around the links */
border-radius: 30px; /* To create the box effect */
transition: background-color 0.3s ease, box-shadow 0.3s ease; /* Smooth transition */
}

.nav-links a:hover {
color: #ffffff;
background-color: #4299e1;
}

.navbar-toggle {
background-color: #4299e1;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 24px;
color: #ffffff;
padding: 10px 15px;
transition: background-color 0.3s ease, transform 0.2s ease;
}

.navbar-toggle:hover {
background-color: #357ae8;
transform: scale(1.05);
}

.nav-menu {
position: fixed;
top: 0;
right: -250px;
width: 250px;
height: 100%;
background-color: #ffffff;
box-shadow: -2px 0 5px rgba(0, 0, 0, 0.3);
transition: right 0.3s ease;
z-index: 10;
}

.nav-menu.active {
right: 0;
}

.close-button {
background-color: #ff4d4d;
border: none;
border-radius: 5px;
font-size: 30px;
color: #ffffff;
cursor: pointer;
position: absolute;
top: 20px;
right: 20px;
padding: 5px 10px;
transition: background-color 0.3s ease, transform 0.2s ease;
}

.close-button:hover {
background-color: #e60000;
transform: scale(1.1);
}

@media (max-width: 768px) {
.container {
justify-content: space-between;
}

.navbar-toggle {
display: block;
}

.nav-links {
flex-direction: column;
align-items: flex-start;
display: none;
width: 100%;
padding: 16px 0;
background-color: #ffffff;
position: absolute;
top: 60px;
left: 0;
z-index: 10;
}

.nav-menu.active .nav-links {
display: flex;
}

.container {
flex-direction: row;
align-items: center;
}

.navbar-toggle {
margin-left: auto;
}
}

@media (min-width: 769px) {
.navbar-toggle {
display: none;
}

.nav-links.desktop-links {
display: flex;
margin-left: auto;
}

.nav-links {
display: flex;
}
background-color: rgba(0, 0, 0, 0.1); /* Slight black box effect on hover */
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15); /* Add shadow for depth */
color: #000; /* Change text color on hover */
}
45 changes: 12 additions & 33 deletions frontend/src/components/Navbar/Navbar.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,22 @@
import React, { useState } from "react";
import "./Navbar.css";

function Navbar() {
const [isActive, setIsActive] = useState(false);

const toggleNavbar = () => {
setIsActive(!isActive);
};

const closeNavbar = () => {
setIsActive(false);
};
import React from "react";
import "./Navbar.css"; // Ensure this matches exactly with the file name

const Navbar = () => {
return (
<nav className={`navbar`}>
<div className="container">
<img src="/images/e1.png" alt="Logo" className="logo" />
<button className="navbar-toggle" onClick={toggleNavbar}>
{/* Hamburger icon */}
</button>
<ul className="nav-links desktop-links">
<nav className="navbar">
<div className="navbar-container">
<div className="logo">
<img src="/images/e1.png" alt="Logo" />
</div>
<ul className="nav-links">
<li><a href="/">Home</a></li>
<li><a href="/about">About Us</a></li>
<li><a href="/contact">Contact Us</a></li>
<li><a href="/loan">Loan</a></li>
</ul>
</div>
<div className={`nav-menu ${isActive ? 'active' : ''}`}>
<button className="close-button" onClick={closeNavbar}>
&times; {/* Close icon */}
</button>
<ul className="nav-links">
<li><a href="/" onClick={closeNavbar}>Home</a></li>
<li><a href="/about" onClick={closeNavbar}>About Us</a></li>
<li><a href="/contact" onClick={closeNavbar}>Contact Us</a></li>
</ul>
</div>
</nav>
);
}
};

export default Navbar;
export default Navbar;

0 comments on commit b99abdc

Please sign in to comment.