@@ -10,10 +10,16 @@ const TopNav = () => {
1010 const router = useRouter ( ) ;
1111 const pathname = usePathname ( ) ;
1212 const [ windowWidth , setWindowWidth ] = useState < number > ( 0 ) ;
13+ const [ isMobileMenuOpen , setIsMobileMenuOpen ] = useState ( false ) ;
14+
1315 useEffect ( ( ) => {
1416 setWindowWidth ( window . innerWidth ) ;
1517 } , [ ] ) ;
1618
19+ const toggleMobileMenu = ( ) => {
20+ setIsMobileMenuOpen ( ! isMobileMenuOpen ) ;
21+ } ;
22+
1723 return (
1824 < div className = "h-16 mb-10 w-full px-3 border-b-[1px] border-slate-700 text-white flex justify-between items-center" >
1925 < div className = "flex items-center flex-col w-1/2" >
@@ -33,19 +39,99 @@ const TopNav = () => {
3339 height = { 50 }
3440 width = { 200 }
3541 />
36- < p className = "text-lg" > 🧪 Practice Exams Platform</ p >
42+ < p className = { `windowWidth < 640 ? "text-lg" : "text-md"` } >
43+ 🧪 Practice Exams Platform
44+ </ p >
3745 </ 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+ ) }
49135 </ div >
50136 </ div >
51137 ) ;
0 commit comments