@@ -2,7 +2,7 @@ import ActiveLink from '@/components/ActiveLink';
22import TitleLogo from '@/components/global/logos/TitleLogo' ;
33import OutsideClick from '@/components/OutsideClick' ;
44import dynamic from 'next/dynamic' ;
5- import { Dispatch , SetStateAction , useEffect , useRef } from 'react' ;
5+ import { Dispatch , LegacyRef , SetStateAction , useEffect , useRef } from 'react' ;
66import { useSigninCheck } from 'reactfire' ;
77
88const AvatarMenu = dynamic < any > ( ( ) => import ( '@/components/user/AvatarMenu' ) , {
@@ -29,6 +29,31 @@ export default function AppMenu({
2929 }
3030 } , [ overlayMenuActive ] ) ;
3131
32+ const Link = ( {
33+ href,
34+ comparison,
35+ name,
36+ ref,
37+ } : {
38+ href : string ;
39+ comparison : string ;
40+ name : string ;
41+ ref ?: LegacyRef < HTMLAnchorElement > | undefined ;
42+ } ) => {
43+ return (
44+ < ActiveLink
45+ activeClassName = "bg-primary-500 rounded-sm"
46+ href = { href }
47+ comparison = { comparison }
48+ >
49+ < a className = "p-2 links-secondary hover:bg-primary-500" ref = { focusme } >
50+ < span className = "sr-only" > { `${ name } ` } </ span >
51+ { name }
52+ </ a >
53+ </ ActiveLink >
54+ ) ;
55+ } ;
56+
3257 return (
3358 < div
3459 className = { `${
@@ -95,51 +120,16 @@ export default function AppMenu({
95120 className = "grid content-start h-full gap-4 p-4 bg-primary-900 dark:bg-primary-900"
96121 aria-label = "Sidebar"
97122 >
98- < ActiveLink
99- activeClassName = "bg-primary-500 rounded-sm"
123+ < Link
100124 href = "/courses"
101125 comparison = "/course"
102- >
103- < a
104- className = "p-2 links-secondary hover:bg-primary-500"
105- ref = { focusme }
106- >
107- Courses
108- </ a >
109- </ ActiveLink >
110- < ActiveLink
111- activeClassName = "bg-primary-500 rounded-sm"
112- href = "/tutorials"
113- comparison = "/tutorial"
114- >
115- < a className = "p-2 links-secondary hover:bg-primary-500" >
116- Tutorials
117- </ a >
118- </ ActiveLink >
119- < ActiveLink
120- activeClassName = "bg-primary-500 rounded-sm"
121- href = "/blog"
122- comparison = "/post"
123- >
124- < a className = "p-2 links-secondary hover:bg-primary-500" > Blog</ a >
125- </ ActiveLink >
126- < ActiveLink
127- activeClassName = "bg-primary-500 rounded-sm"
128- href = "/podcasts"
129- comparison = "/podcast"
130- >
131- < a className = "p-2 links-secondary hover:bg-primary-500" >
132- Podcasts
133- </ a >
134- </ ActiveLink >
135- < ActiveLink
136- activeClassName = "bg-primary-500 rounded-sm"
137- href = "/schedule"
138- >
139- < a className = "p-2 links-secondary hover:bg-primary-500" >
140- Schedule
141- </ a >
142- </ ActiveLink >
126+ name = "Courses"
127+ ref = { focusme }
128+ />
129+ < Link href = "/tutorials" comparison = "/tutorial" name = "Tutorials" />
130+ < Link href = "/blog" comparison = "/post" name = "Blog" />
131+ < Link href = "/podcasts" comparison = "/podcast" name = "Podcasts" />
132+ < Link href = "/schedule" comparison = "/schedule" name = "Schedule" />
143133 </ nav >
144134 < section className = "flex self-end p-4 bg-primary-700 dark:bg-primary-700" >
145135 < OutsideClick toggle = { setUserMenu } value = { false } >
0 commit comments