hover nav bar

This commit is contained in:
MathewFrancis 2025-06-04 14:45:14 +05:30
parent 5f41511ee0
commit 2d387276e6
2 changed files with 63 additions and 51 deletions

View File

@ -10,32 +10,17 @@ import { useState } from "react";
export default function NavBar() { export default function NavBar() {
const navTo = useNavigate(); const navTo = useNavigate();
// useState for boolean trigger... when inverted
// it should display the associated drop down message
const [operations, operationsInverter] = useState(false);
const [profile, profileInverter] = useState(false);
const truthInverter = () => {
profileInverter((prev) => (prev = false));
operationsInverter((prev) => (prev = !prev));
};
const profInverter = () => {
operationsInverter((prev) => (prev = false));
profileInverter((prev) => (prev = !prev));
};
return ( return (
<nav className="navigation"> <nav className="navigation">
<div> <div>
<CezenBanner className="cezen_banner_top" /> <CezenBanner className="cezen_banner_top" />
</div> </div>
<div className="RHS_nav"> <div className="nav-item">
<div className="RHS_nav_pill" onClick={truthInverter}> <div className="RHS_nav ops">
<div className="RHS_nav_pill">
<img src={operationsLogo} /> <img src={operationsLogo} />
operations <span> operations</span>
</div> </div>
{operations && (
<div className="drop-down pos_operations"> <div className="drop-down pos_operations">
<NavBarDropDown> <NavBarDropDown>
{/* css is defined in the NavBarDropDown.css folder*/} {/* css is defined in the NavBarDropDown.css folder*/}
@ -56,12 +41,12 @@ export default function NavBar() {
<li>Groups</li> <li>Groups</li>
</NavBarDropDown> </NavBarDropDown>
</div> </div>
)}
<div className="RHS_nav_pill" onClick={profInverter}>
<img src={profileLogo} />
profile
</div> </div>
{profile && ( <div className="RHS_nav prof">
<div className="RHS_nav_pill">
<img src={profileLogo} />
<span className="profile_text"> profile</span>
</div>
<div className="drop-down pos_profile"> <div className="drop-down pos_profile">
<NavBarDropDown> <NavBarDropDown>
{/* css is defined in the NavBarDropDown.css folder*/} {/* css is defined in the NavBarDropDown.css folder*/}
@ -83,7 +68,7 @@ export default function NavBar() {
</li> </li>
</NavBarDropDown> </NavBarDropDown>
</div> </div>
)} </div>
</div> </div>
</nav> </nav>
); );

View File

@ -17,15 +17,24 @@
margin-left: 0rem; margin-left: 0rem;
} }
.navigation span:hover { .nav-item {
cursor: pointer; position: relative;
margin-right: 0.4rem; display: flex;
margin-left: 0.4rem; flex-direction: row;
gap: 2.4rem;
/* align-items: center; */
} }
.cezen_banner_top { .cezen_banner_top {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
-webkit-user-select: none; /* Safari */
-ms-user-select: none; /* IE 10 and IE 11 */
user-select: none; /* Standard syntax */
}
.cezen_banner_top:hover {
cursor: pointer;
} }
.cezen_banner_top h1 { .cezen_banner_top h1 {
@ -47,50 +56,68 @@
.RHS_nav { .RHS_nav {
color: #1f3890; color: #1f3890;
display: flex;
flex-direction: row;
gap: 2.4rem;
align-items: center;
text-transform: uppercase; text-transform: uppercase;
margin-right: 1rem; margin-right: 1rem;
position: relative; padding: 1.5rem 0rem;
border-bottom: 0.4rem solid rgba(202, 240, 248, 0.3);
transition: all 0.3s;
align-self: center;
}
.RHS_nav:hover {
border-bottom: 0.2rem solid rgba(0, 137, 133, 0.8);
margin-bottom: 0rem;
} }
.RHS_nav .RHS_nav_pill { .RHS_nav .RHS_nav_pill {
padding-left: 1rem; display: flex;
padding-bottom: 0rem;
border-bottom: 0.4rem solid rgba(202, 240, 248, 0.3);
transition: all 0.3s;
} }
.RHS_nav .RHS_nav_pill:hover { .RHS_nav .RHS_nav_pill:hover {
padding-left: 1rem;
padding-bottom: 0.5rem;
border-bottom: 0.2rem solid rgba(0, 137, 133, 0.8);
cursor: pointer;
margin-bottom: 0rem;
} }
.RHS_nav div img { .RHS_nav div img {
max-width: 2.2rem; max-width: 2.2rem;
margin-right: 0.6rem; margin-right: 0.6rem;
margin-bottom: -0.4rem; margin-bottom: -0.8rem;
}
.RHS_nav div span {
margin-right: 7rem;
margin-top: 1rem;
}
.RHS_nav div .profile_text {
margin-right: 3.2rem;
} }
.drop-down { .drop-down {
position: absolute; position: absolute;
/* the width of the drop down */ /* the width of the drop down */
min-width: 14rem; min-width: 16rem;
padding: 1.4rem;
padding-top: 2.4rem;
background: rgba(0, 137, 133, 0);
display: none;
}
/* .nav-item:hover .drop-down.pos_operations {
display: block;
} */
.RHS_nav.ops:hover .drop-down.pos_operations {
display: block;
}
.RHS_nav.prof:hover .drop-down.pos_profile {
display: block;
} }
.pos_operations { .pos_operations {
top: 100%; top: 65%;
left: 2.5%; left: -1.5%;
transform: translate(-5%, 1%); transform: translate(-5%, 1%);
} }
.pos_profile { .pos_profile {
top: 100%; top: 65%;
left: 60.5%; left: 58%;
transform: translate(-5%, 1%); transform: translate(-5%, 1%);
} }