-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHamburger.tsx
58 lines (56 loc) · 1.58 KB
/
Hamburger.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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>
);
}