@@ -11,7 +11,7 @@ import AppThemeToggle from './AppThemeToggle';
11
11
* Navigation bar for users to navigate between pages.
12
12
*/
13
13
14
- const navBarClass = "fixed top-0 w-full z-50 text-white py-2 px-6 flex justify-between items-center"
14
+ const navBarClass = "sticky bg-black top-0 w-full z-50 text-white py-2 px-6 flex justify-between items-center"
15
15
const NavigationBar = ( ) => {
16
16
// context for handling user data
17
17
const { isLoggedIn, setIsLoggedIn, setUserData } = useAuth ( )
@@ -26,26 +26,25 @@ const NavigationBar = () => {
26
26
setMenuOpen ( ! menuOpen )
27
27
}
28
28
29
- const navbarRef = useRef < HTMLDivElement > ( null )
29
+ const navbarRef = useRef < HTMLDivElement > ( null )
30
30
31
- useEffect ( function ( ) {
32
- window . addEventListener ( 'scroll' , function ( e ) {
33
- if ( navbarRef . current ) {
34
- if ( window . scrollY >= 50 ) {
35
- navbarRef . current . className = navBarClass + ' opacity-80 bg-black '
36
- } else {
37
- navbarRef . current . className = navBarClass
38
- }
39
- }
40
- } )
41
- } , [ ] )
31
+ useEffect ( function ( ) {
32
+ window . addEventListener ( 'scroll' , function ( e ) {
33
+ if ( navbarRef . current ) {
34
+ if ( window . scrollY >= 50 ) {
35
+ navbarRef . current . className = navBarClass + ' opacity-80'
36
+ } else {
37
+ navbarRef . current . className = navBarClass
38
+ }
39
+ }
40
+ } )
41
+ } , [ ] )
42
42
43
43
return (
44
44
< nav
45
- className = "sticky top-0 w-full z-50
46
- text-white py-2 px-6 flex justify-between items-center"
45
+ className = { navBarClass }
47
46
style = { { height : '8vh' } }
48
- ref = { navbarRef }
47
+ ref = { navbarRef }
49
48
>
50
49
< Link to = "/" >
51
50
{ ' ' }
0 commit comments