Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix : Navbar Alignment and Navbar Responsiveness for Medium Devices #392

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/componets/Navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,8 @@ body.menu-open {
display: flex;
}

@media (max-width: 1175px) { /*to prevent overlapping of nav items and mobile menu icon*/
.right-nav {
display: none;
}
}
24 changes: 21 additions & 3 deletions src/componets/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const NavbarContainer = styled(motion.nav)`
transition: all 0.3s ease;
border-bottom: 2px solid #8b4513;


&.scrolled {
padding: 0.8rem 2rem;
background: rgba(44, 19, 11, 0.98);
Expand Down Expand Up @@ -78,7 +79,7 @@ const Logo = styled(motion.div)`

const RightNav = styled(motion.div)`
display: flex;
justify-content: space-around;
justify-content: end; //now all the nav items are displayed
align-items: center;
padding: 1rem 2rem;
position: fixed;
Expand All @@ -104,6 +105,7 @@ const RightNav = styled(motion.div)`
opacity: 0.05;
pointer-events: none;
}

`;

const NavLinks = styled(motion.div)`
Expand All @@ -114,9 +116,18 @@ const NavLinks = styled(motion.div)`
margin: 10px;
align-items: center;

@media (max-width: 768px) {
@media (max-width: 1175px) {
display: none;
}

@media (max-width: 1200px) {
gap: 1.5rem; /* Reduce spacing for medium screens */
}





`;

const NavLink = styled(motion.div)`
Expand Down Expand Up @@ -155,6 +166,10 @@ padding: 20px;
&:hover::after {
transform: translateX(-50%) scale(1);
}




`;

const MobileMenuButton = styled(motion.button)`
Expand All @@ -168,7 +183,7 @@ const MobileMenuButton = styled(motion.button)`
border-radius: 8px;
transition: all 0.3s ease;

@media (max-width: 768px) {
@media (max-width: 1175px) {
display: flex;
align-items: center;
justify-content: center;
Expand Down Expand Up @@ -309,6 +324,7 @@ function Navbar() {
<Link to="/">MsCafe</Link>
</Logo>
<ul>
<div className=".right-nav">
<RightNav>
{navItems.map((items) => {
if (items.title === "Product") {
Expand Down Expand Up @@ -446,6 +462,8 @@ function Navbar() {
{isOpen ? "×" : "☰"}
</MobileMenuButton>
</RightNav>
</div>

</ul>
</NavbarContainer>

Expand Down
Loading