Skip to content

Commit 9ec800c

Browse files
files
1 parent 7f59d07 commit 9ec800c

File tree

2 files changed

+45
-3
lines changed

2 files changed

+45
-3
lines changed

components/navbar.js

+28-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@ import styles from "../styles/Navbar.module.css";
22
import Aos from "aos";
33
import "aos/dist/aos.css";
44
import { useEffect, useState } from 'react'
5-
import { Link } from '@chakra-ui/react';
5+
import { Drawer, DrawerBody, DrawerContent, DrawerHeader, DrawerOverlay, Link, useDisclosure } from '@chakra-ui/react';
6+
import { FaBars } from "react-icons/fa";
7+
import { useRouter } from "next/router";
68

79
export default function Navbar() {
10+
11+
const { isOpen, onOpen, onClose } = useDisclosure()
12+
const [placement, setPlacement] = useState('bottom')
13+
const router = useRouter();
14+
815
useEffect(() => {
916
Aos.init({ duration: 2000 })
1017
})
@@ -31,11 +38,29 @@ export default function Navbar() {
3138
<form autoComplete="off" className={styles.form}>
3239
<Link href="/" className={styles.sign}>Home</Link>
3340
<Link href="courses" className={styles.sign}>Courses</Link>
34-
<Link href="signin" className={styles.sign}>Signin</Link>
35-
<Link href="signup" className={styles.sign}>Signup</Link>
41+
<Link onClick={() => router.push("/signin")} className={styles.sign}>Signin</Link>
42+
<Link onClick={() => router.push("/signup")} className={styles.sign}>Signup</Link>
3643
<Link href="dashboard" className={styles.sign}>Dashboard</Link>
3744
<Link href="cart" className={styles.sign}>Cart</Link>
3845

46+
{/* drawer */}
47+
<FaBars onClick={onOpen} className={styles.bar}/>
48+
<Drawer placement={placement} onClose={onClose} isOpen={isOpen}>
49+
<DrawerOverlay />
50+
<DrawerContent>
51+
52+
<DrawerBody className={styles.draw}>
53+
54+
<Link href="/"><p>Home</p></Link>
55+
<Link href="courses"><p>Courses</p></Link>
56+
<Link onClick={() => router.push("/signin")}><p>Signin</p></Link>
57+
<Link onClick={() => router.push("/signup")}><p>Signup</p></Link>
58+
<Link href="dashboard"><p>Dashboard</p></Link>
59+
<Link href="cart"><p>Cart</p></Link>
60+
</DrawerBody>
61+
</DrawerContent>
62+
</Drawer>
63+
3964
</form>
4065

4166
</div>

styles/Navbar.module.css

+17
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,20 @@
160160
.submit:active {
161161
opacity: 0.8;
162162
}
163+
/* drawer */
164+
.bar {
165+
color:#45f3ff;
166+
margin-top: -0.7rem;
167+
font-size: 1.3rem;
168+
}
169+
170+
.draw {
171+
/* border: 1px solid red; */
172+
background-color: #43b2ba;
173+
font-size: large;
174+
font-weight: 600;
175+
line-height: 2.5em;
176+
177+
178+
179+
}

0 commit comments

Comments
 (0)