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

navbar update #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions components/Hero.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const HeroContainer = styled.div`
@media (max-width: 1050px) {
gap: 5px;
}
@media (max-width: 768px) {
margin-top:70px;
}
font-family: 'Roboto', sans-serif;
`

Expand Down
67 changes: 59 additions & 8 deletions components/Navbar.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React, { useState } from "react";
import styled from "styled-components";

const NavbarContainer = styled.div`
Expand All @@ -15,29 +15,80 @@ const NavbarContainer = styled.div`
padding-right: 100px;
}
font-family: 'Roboto', sans-serif;
@media (max-width: 768px) {
width:100%;
position:absolute;
top:0;
background-color: #7baaf7;
overflow:hidden;
flex-direction: column;
align-items: flex-end;
height:${({ showNav }) =>
showNav ? 75 : 350
}px;
`

const NavLinks = styled.a`
padding: 15px;
font-family: 'Roboto', sans-serif;
@media (max-width: 768px) {
display:${({ showNav }) =>
showNav ? `none` : `block`
};

}
`

const SignIn = styled.a`
padding: 15px;
background-color: white;
border-radius: 10px;
font-family: 'Roboto', sans-serif;
`
@media (max-width: 768px) {
display:${({ showNav }) =>
showNav ? `none` : `block`
};

}

`

const Hmburger = styled.div`
display: flex;
flex-direction: column;
cursor: pointer;
padding: 15px;
span {
height: 2px;
width: 25px;
background: #000;
margin-bottom: 4px;
border-radius: 5px;
}
@media (min-width: 768px) {
display:none;
}`

export const Navbar = () => {
const [showNav, setShowNav] = useState(true);
return (
<>
<NavbarContainer>
<NavLinks href="/">Home</NavLinks>
<NavLinks href="/">Events</NavLinks>
<NavLinks href="/">About Us</NavLinks>
<NavLinks href="/">FAQs</NavLinks>
<SignIn href="/">Sign In</SignIn>
<NavbarContainer showNav={showNav}>
<Hmburger
onClick={() => {
setShowNav(!showNav);
console.log(showNav);
}}
>
<span></span>
<span></span>
<span></span>
</Hmburger>
<NavLinks showNav={showNav} href="/">Home</NavLinks>
<NavLinks showNav={showNav} href="/">Events</NavLinks>
<NavLinks showNav={showNav} href="/">About Us</NavLinks>
<NavLinks showNav={showNav} href="/">FAQs</NavLinks>
<SignIn showNav={showNav} href="/">Sign In</SignIn>
</NavbarContainer>
</>
)
Expand Down