@@ -10,10 +10,16 @@ const TopNav = () => {
10
10
const router = useRouter ( ) ;
11
11
const pathname = usePathname ( ) ;
12
12
const [ windowWidth , setWindowWidth ] = useState < number > ( 0 ) ;
13
+ const [ isMobileMenuOpen , setIsMobileMenuOpen ] = useState ( false ) ;
14
+
13
15
useEffect ( ( ) => {
14
16
setWindowWidth ( window . innerWidth ) ;
15
17
} , [ ] ) ;
16
18
19
+ const toggleMobileMenu = ( ) => {
20
+ setIsMobileMenuOpen ( ! isMobileMenuOpen ) ;
21
+ } ;
22
+
17
23
return (
18
24
< div className = "h-16 mb-10 w-full px-3 border-b-[1px] border-slate-700 text-white flex justify-between items-center" >
19
25
< div className = "flex items-center flex-col w-1/2" >
@@ -33,19 +39,99 @@ const TopNav = () => {
33
39
height = { 50 }
34
40
width = { 200 }
35
41
/>
36
- < p className = "text-lg" > 🧪 Practice Exams Platform</ p >
42
+ < p className = { `windowWidth < 640 ? "text-lg" : "text-md"` } >
43
+ 🧪 Practice Exams Platform
44
+ </ p >
37
45
</ div >
38
- < div className = "flex items-center flex-col pt-1 w-1/2" >
39
- < GitHubButton
40
- href = "https://github.com/Ditectrev/Practice-Exams-Platform"
41
- data-color-scheme = "no-preference: light; light: light; dark: dark;"
42
- data-icon = "octicon-star"
43
- data-size = "large"
44
- data-show-count = "true"
45
- aria-label = "Star our platform on GitHub"
46
- >
47
- { windowWidth < 640 ? "" : "Star" }
48
- </ GitHubButton >
46
+ < div className = "flex items-center pt-1 w-1/2" >
47
+ { windowWidth < 640 && (
48
+ < div
49
+ onClick = { toggleMobileMenu }
50
+ className = "cursor-pointer mx-auto text-white"
51
+ >
52
+ ☰
53
+ </ div >
54
+ ) }
55
+ { isMobileMenuOpen && (
56
+ < div >
57
+ < a
58
+ href = "https://apps.apple.com/app/cloudmaster-swift/id6503601139"
59
+ className = "mr-4 text-white"
60
+ target = "_blank"
61
+ rel = "noopener noreferrer"
62
+ aria-label = "Visit our iOS App"
63
+ >
64
+ iOS App
65
+ </ a >
66
+ < a
67
+ href = "https://shop.ditectrev.com"
68
+ className = "mr-4 text-white"
69
+ target = "_blank"
70
+ rel = "noopener noreferrer"
71
+ aria-label = "Visit our Shop"
72
+ >
73
+ Shop
74
+ </ a >
75
+ < GitHubButton
76
+ href = "https://github.com/Ditectrev/Practice-Exams-Platform"
77
+ data-color-scheme = "no-preference: light; light: light; dark: dark;"
78
+ data-icon = "octicon-star"
79
+ data-size = "large"
80
+ data-show-count = "true"
81
+ aria-label = "Star our platform on GitHub"
82
+ >
83
+ { windowWidth < 640 ? "" : "Star" }
84
+ </ GitHubButton >
85
+ < div className = "flex items-center pt-1 w-1/2" >
86
+ { windowWidth < 640 && (
87
+ < div
88
+ onClick = { toggleMobileMenu }
89
+ className = "cursor-pointer mx-auto text-white"
90
+ >
91
+ ☰
92
+ </ div >
93
+ ) }
94
+ { isMobileMenuOpen && (
95
+ < div className = "fixed top-0 left-0 w-full h-full bg-black bg-opacity-90 flex flex-col items-center justify-center z-50" >
96
+ < a
97
+ href = "https://apps.apple.com/app/cloudmaster-swift/id6503601139"
98
+ className = "mb-4 text-white text-xl"
99
+ target = "_blank"
100
+ rel = "noopener noreferrer"
101
+ aria-label = "Visit our iOS App"
102
+ >
103
+ iOS App
104
+ </ a >
105
+ < a
106
+ href = "https://shop.ditectrev.com"
107
+ className = "mb-4 text-white text-xl"
108
+ target = "_blank"
109
+ rel = "noopener noreferrer"
110
+ aria-label = "Visit our Shop"
111
+ >
112
+ Shop
113
+ </ a >
114
+ < GitHubButton
115
+ href = "https://github.com/Ditectrev/Practice-Exams-Platform"
116
+ data-color-scheme = "no-preference: light; light: light; dark: dark;"
117
+ data-icon = "octicon-star"
118
+ data-size = "large"
119
+ data-show-count = "true"
120
+ aria-label = "Star our platform on GitHub"
121
+ >
122
+ { windowWidth < 640 ? "" : "Star" }
123
+ </ GitHubButton >
124
+ < button
125
+ onClick = { toggleMobileMenu }
126
+ className = "mt-4 text-white text-xl"
127
+ >
128
+ Close
129
+ </ button >
130
+ </ div >
131
+ ) }
132
+ </ div >
133
+ </ div >
134
+ ) }
49
135
</ div >
50
136
</ div >
51
137
) ;
0 commit comments