-
Notifications
You must be signed in to change notification settings - Fork 0
[CW2-9] Add navbar / hamburger menu to mobile #8
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
Changes from 3 commits
aabb7c0
650e22e
d7d746a
d3333e6
0811e61
c0a370b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React from 'react'; | ||
import { AnimatePresence, motion, useCycle } from 'framer-motion'; | ||
import Link from 'next/link'; | ||
|
||
export default function Hamburger() { | ||
const [isOpen, toggleOpen] = useCycle(false, true); | ||
|
||
return ( | ||
<button | ||
onClick={() => { | ||
toggleOpen(); | ||
}} | ||
className="focus:outline-none" | ||
> | ||
<svg | ||
className="w-6 h-6" | ||
fill="none" | ||
stroke="currentColor" | ||
viewBox="0 0 24 24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
strokeWidth={2} | ||
d="M4 6h16M4 12h16m-7 6h7" | ||
/> | ||
</svg> | ||
<AnimatePresence> | ||
{isOpen && ( | ||
<motion.div | ||
initial={{ opacity: 0, y: -10 }} | ||
animate={{ opacity: 1, y: 0 }} | ||
exit={{ opacity: 0, y: -10 }} | ||
transition={{ duration: 0.2 }} | ||
className="absolute top-16 right-0 bg-[#3977F9] p-4 shadow-lg w-40 rounded-2xl" | ||
style={{ height: '85vh' }} | ||
> | ||
<ul> | ||
<li className="py-2"> | ||
<Link href={'#about'}>About Us</Link> | ||
</li> | ||
<li className="py-2"> | ||
<Link href={'#events'}>Events</Link> | ||
</li> | ||
<li className="py-2"> | ||
<Link href={'/resources'}>Resources</Link> | ||
</li> | ||
<li className="py-2"> | ||
<Link href={'#sponsors'}>Sponsors</Link> | ||
</li> | ||
</ul> | ||
</motion.div> | ||
)} | ||
</AnimatePresence> | ||
</button> | ||
); | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this? I think try to keep consistent to tailwind (for better or for worse) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah sorry, the animation css I got from somewhere else. I'll try and make it "proper" by Thursday! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay committed |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
body { | ||
background-color: #1a0554; | ||
font-family: "Roboto", sans-serif; | ||
} | ||
|
||
main { | ||
display: flex; | ||
} | ||
|
||
aside { | ||
background-color: #c4a8ff; | ||
width: 18.75rem; | ||
height: 100vh; | ||
} | ||
|
||
.container { | ||
margin: 4.5rem 1.4rem; | ||
} | ||
|
||
.btn-container { | ||
position: fixed; | ||
} | ||
|
||
.container a { | ||
color: #f9fafb; | ||
text-decoration: none; | ||
font-size: 1.75rem; | ||
font-weight: 600; | ||
display: block; | ||
margin: 20px; | ||
} | ||
|
||
button { | ||
cursor: pointer; | ||
margin: 1.25rem; | ||
border: none; | ||
padding: 0.5rem 1rem; | ||
background-color: #f9fafb; | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should all be
href={'about'}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now all the fancy CSS animation is gone. It should be functional now.