1
- import { useState , useEffect } from ' react' ;
1
+ import { useState , useEffect } from " react" ;
2
2
import { Link , useLocation } from "react-router-dom" ;
3
3
import kwoc_logo from "../assets/kwoc_logo.png" ;
4
4
import "../styles/Navbar.css" ;
7
7
GH_OAUTH_URL ,
8
8
REGISTRATIONS_OPEN ,
9
9
} from "../util/constants" ;
10
- import { useAuthContext } from ' ../util/auth' ;
11
- import { UserType } from ' ../util/types' ;
10
+ import { useAuthContext } from " ../util/auth" ;
11
+ import { UserType } from " ../util/types" ;
12
12
13
13
function LoginButton ( ) {
14
14
const authContext = useAuthContext ( ) ;
@@ -31,24 +31,20 @@ function LoginButton() {
31
31
) : REGISTRATIONS_OPEN ? (
32
32
[ "mentor" , "student" ] . map ( ( userType , i ) => (
33
33
< button
34
- className = ' reg-button'
34
+ className = " reg-button"
35
35
key = { i }
36
36
onClick = { ( e ) => {
37
37
e . preventDefault ( ) ;
38
38
39
39
authContext . setUserType ( userType as UserType ) ;
40
- window . location . href = GH_OAUTH_URL
40
+ window . location . href = GH_OAUTH_URL ;
41
41
} }
42
42
>
43
43
{ userType . toUpperCase ( ) } LOGIN
44
44
</ button >
45
45
) )
46
46
) : (
47
- < Link
48
- to = { GH_OAUTH_URL }
49
- >
50
- LOGIN
51
- </ Link >
47
+ < Link to = { GH_OAUTH_URL } > LOGIN</ Link >
52
48
) }
53
49
</ >
54
50
) ;
@@ -73,26 +69,20 @@ const Navbar = () => {
73
69
} , [ location . pathname ] ) ;
74
70
75
71
function closeNavbar ( ) {
76
- const element = document . getElementById ( ' linkList' ) ;
72
+ const element = document . getElementById ( " linkList" ) ;
77
73
78
- if ( element ) {
79
- element . addEventListener ( ' click' , ( ) => {
80
- element . classList . remove ( ' open' ) ;
74
+ if ( element ) {
75
+ element . addEventListener ( " click" , ( ) => {
76
+ element . classList . remove ( " open" ) ;
81
77
} ) ;
82
78
}
83
79
setIsOpen ( false ) ;
84
80
}
85
81
86
82
return (
87
- < div className = 'navbar' >
88
- < div className = 'light-logo' >
89
- < Link to = "/" >
90
- < img
91
- className = "logo"
92
- src = { kwoc_logo }
93
- alt = "KWoC Logo"
94
- />
95
- </ Link >
83
+ < div className = "navbar" >
84
+ < div className = "light-logo" >
85
+ < img className = "logo" src = { kwoc_logo } alt = "KWoC Logo" />
96
86
< div className = "container" >
97
87
< div className = "dots dot1" > </ div >
98
88
< div className = "dots dot2" > </ div >
@@ -102,20 +92,28 @@ const Navbar = () => {
102
92
< div className = "dots dot6" > </ div >
103
93
</ div >
104
94
</ div >
105
- < ul id = "linkList" className = { `link-container ${ isOpen ? ' open' : '' } ` } >
95
+ < ul id = "linkList" className = { `link-container ${ isOpen ? " open" : "" } ` } >
106
96
{ LINKS . map ( ( link ) => (
107
97
< li key = { link . name } >
108
- < Link to = { link . link } className = { link . isActive ? `link nav-glow` : `link` } onClick = { ( ) => { closeNavbar ( ) } } >
98
+ < Link
99
+ to = { link . link }
100
+ className = { link . isActive ? `link nav-glow` : `link` }
101
+ onClick = { ( ) => {
102
+ closeNavbar ( ) ;
103
+ } }
104
+ >
109
105
{ link . name }
110
106
</ Link >
111
107
</ li >
112
108
) ) }
113
109
114
110
< LoginButton />
115
111
</ ul >
116
- < div className = 'burger' onClick = { ( ) => setIsOpen ( ! isOpen ) } > { isOpen ? '✖' : '☰' } </ div >
112
+ < div className = "burger" onClick = { ( ) => setIsOpen ( ! isOpen ) } >
113
+ { isOpen ? "✖" : "☰" }
114
+ </ div >
117
115
</ div >
118
- )
119
- }
116
+ ) ;
117
+ } ;
120
118
121
- export default Navbar
119
+ export default Navbar ;
0 commit comments