Skip to content

Commit aabb7c0

Browse files
committed
added id for sponsors and added hamburger menu
1 parent 3fa4d93 commit aabb7c0

File tree

6 files changed

+126
-2
lines changed

6 files changed

+126
-2
lines changed

components/Hamburger.tsx

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import React from "react";
2+
import { AnimatePresence, motion, useCycle } from "framer-motion";
3+
import Link from "next/link";
4+
5+
export default function Hamburger () {
6+
7+
const [isOpen, toggleOpen] = useCycle(false, true);
8+
9+
return (
10+
<button onClick={() => {toggleOpen()}} className="focus:outline-none">
11+
<svg
12+
className="w-6 h-6"
13+
fill="none"
14+
stroke="currentColor"
15+
viewBox="0 0 24 24"
16+
xmlns="http://www.w3.org/2000/svg"
17+
>
18+
<path
19+
strokeLinecap="round"
20+
strokeLinejoin="round"
21+
strokeWidth={2}
22+
d="M4 6h16M4 12h16m-7 6h7"
23+
/>
24+
</svg>
25+
<AnimatePresence>
26+
{isOpen && (
27+
<motion.div
28+
initial={{ opacity: 0, y: -10 }}
29+
animate={{ opacity: 1, y: 0 }}
30+
exit={{ opacity: 0, y: -10 }}
31+
transition={{ duration: 0.2 }}
32+
className="absolute top-16 right-0 bg-[#3977F9] p-4 shadow-lg w-40 rounded-2xl"
33+
style={{height: "85vh"}}
34+
>
35+
<ul>
36+
<li className="py-2"><Link href={"#about"}>About Us</Link></li>
37+
<li className="py-2"><Link href={"#events"}>Events</Link></li>
38+
<li className="py-2"><Link href={"/resources"}>Resources</Link></li>
39+
<li className="py-2"><Link href={"#sponsors"}>Sponsors</Link></li>
40+
</ul>
41+
</motion.div>
42+
)}
43+
</AnimatePresence>
44+
</button>
45+
);
46+
}

components/Navbar.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Image from 'next/image';
22
import Link from 'next/link';
33
import { useEffect, useState } from 'react';
4+
import Hamburger from './Hamburger';
45

56
const Navbar = () => {
67
const [path, setPath] = useState<string>('');
@@ -28,7 +29,7 @@ const Navbar = () => {
2829
<p className="text-[0.6rem] text-[#C4C5C8]">01</p>
2930
<div>{'//'} about us</div>
3031
</Link>
31-
<Link href="events">
32+
<Link href="#events">
3233
<p className="text-[0.6rem] text-[#C4C5C8]">02</p>
3334
<div>{'//'} events</div>
3435
</Link>
@@ -41,6 +42,9 @@ const Navbar = () => {
4142
<div>{'//'} sponsors</div>
4243
</Link>
4344
</div>
45+
<div className='md:hidden xl:hidden lg:hidden text-right font-bold block'>
46+
<Hamburger/>
47+
</div>
4448
</div>
4549
</nav>
4650
);

components/Sponsors/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const Sponsors = () => {
88
'xl:p-16 p-10 flex justify-center items-center xl:col-span-3 sm:col-span-5 col-span-10 xl:row-start-2 xl:row-end-3 sm:row-start-4 sm:row-end-5 sm:h-auto h-36';
99

1010
return (
11-
<section className="flex flex-col min-h-screen py-8 xl:px-24 sm:px-10 px-8 relative mt-20">
11+
<section className="flex flex-col min-h-screen py-8 xl:px-24 sm:px-10 px-8 relative mt-20" id="sponsors">
1212
<div className="text-center">
1313
<p className="text-[#3977F8] font-game text-xl">04</p>
1414
<h2 className="font-bold text-6xl">SUPPORT CSESOC</h2>

components/styles.css

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
body {
2+
background-color: #1a0554;
3+
font-family: "Roboto", sans-serif;
4+
}
5+
6+
main {
7+
display: flex;
8+
}
9+
10+
aside {
11+
background-color: #c4a8ff;
12+
width: 18.75rem;
13+
height: 100vh;
14+
}
15+
16+
.container {
17+
margin: 4.5rem 1.4rem;
18+
}
19+
20+
.btn-container {
21+
position: fixed;
22+
}
23+
24+
.container a {
25+
color: #f9fafb;
26+
text-decoration: none;
27+
font-size: 1.75rem;
28+
font-weight: 600;
29+
display: block;
30+
margin: 20px;
31+
}
32+
33+
button {
34+
cursor: pointer;
35+
margin: 1.25rem;
36+
border: none;
37+
padding: 0.5rem 1rem;
38+
background-color: #f9fafb;
39+
}
40+

package-lock.json

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@types/react-dom": "18.2.7",
2020
"autoprefixer": "10.4.15",
2121
"eslint-config-next": "13.4.19",
22+
"framer-motion": "^11.1.2",
2223
"next": "13.4.19",
2324
"postcss": "8.4.29",
2425
"react": "18.2.0",

0 commit comments

Comments
 (0)