11import { useRouter } from "next/router" ;
2- import Link from "next/link" ;
32import { useCallback , useState } from "react" ;
43import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" ;
54import {
@@ -15,29 +14,30 @@ import { Button, Dropdown, Input, Menu } from "antd";
1514
1615import { ThemeSwitcher } from "./theme-switcher" ;
1716import { LinkInternal } from "./links/internal" ;
17+ import styles from "./header.module.scss"
1818
1919import { UserRank } from "#api/types" ;
2020import { onParentBlur } from "#lib/dom" ;
21- import { Icon } from "#components/icons" ;
2221
2322interface IHeaderProps extends Record < string , unknown > { }
2423export function Header ( { userData, dataless } : IHeaderProps ) {
2524 return (
26- < nav className = "h-16 bg-white dark:bg-gray-800 shadow flex justify-center" >
27- < div className = "max-w-screen-lg w-screen flex justify-start items-center gap-x-4 mx-4" >
25+ < header className = { styles . block } >
26+ < nav className = "max-w-screen-lg w-screen flex justify-start items-center gap-x-4 mx-4" >
2827 < div className = "flex justify-start flex-grow-0" >
29- < Link className = "text-2xl font-black text-blue-500" href = "/" >
28+ { /* @TODO : site logo component */ }
29+ < LinkInternal className = { styles . logo } href = "/" >
3030 Horahora
31- </ Link >
31+ </ LinkInternal >
3232 </ div >
3333 < Search />
3434 { ! dataless && (
3535 < div className = "flex-grow-0 ml-auto" >
3636 < UserNav userData = { userData } />
3737 </ div >
3838 ) }
39- </ div >
40- </ nav >
39+ </ nav >
40+ </ header >
4141 ) ;
4242}
4343
@@ -163,46 +163,32 @@ function LoggedInUserNav(props: ILoggedInUserNav) {
163163
164164 let menu = (
165165 < Menu className = "bg-white dark:bg-black" >
166- < Menu . Item key = "upload" icon = { < Icon icon = { faUpload } /> } >
167- < LinkInternal href = "/account/upload" > Upload</ LinkInternal >
166+ < Menu . Item key = "upload" >
167+ < LinkInternal iconID = { faUpload } href = "/account/upload" >
168+ Upload
169+ </ LinkInternal >
168170 </ Menu . Item >
169- < Menu . Item key = "profile" icon = { < Icon icon = { faUser } /> } >
170- < Link
171- className = "text-black dark:text-white dark:hover:text-black"
171+ < Menu . Item key = "profile" >
172+ < LinkInternal
173+ iconID = { faUser }
172174 // @ts -expect-error figure `userData` shape
173175 href = { `/users/${ userData . userID } ` }
174176 >
175177 Profile page
176- </ Link >
178+ </ LinkInternal >
177179 </ Menu . Item >
178180 < Menu . Divider />
179181
180182 < Menu . Item
181183 key = "password-reset"
182- icon = {
183- < FontAwesomeIcon
184- className = "max-h-4 text-black dark:text-white"
185- icon = { faKey }
186- />
187- }
188184 >
189- < Link className = "text-black dark:text-white" href = "/password-reset" >
190- Reset Password
191- </ Link >
185+ < LinkInternal iconID = { faKey } href = "/password-reset" > Reset Password</ LinkInternal >
192186 </ Menu . Item >
193187 < Menu . Divider />
194188 < Menu . Item
195189 key = "logout"
196- icon = {
197- < FontAwesomeIcon
198- className = "max-h-4 text-red-600"
199- icon = { faSignOutAlt }
200- />
201- }
202190 >
203- < Link className = "text-black dark:text-white" href = "/logout" >
204- Logout
205- </ Link >
191+ < LinkInternal iconID = { faSignOutAlt } href = "/logout" > Logout</ LinkInternal >
206192 </ Menu . Item >
207193 </ Menu >
208194 ) ;
@@ -229,43 +215,29 @@ function LoggedInAdminNav(props: ILoggedInAdminNav) {
229215 < Menu className = "bg-white dark:bg-black" >
230216 < Menu . Item
231217 key = "profile"
232- icon = {
233- < FontAwesomeIcon
234- className = "max-h-4 text-black dark:text-white"
235- icon = { faUser }
236- />
237- }
238218 >
239- < Link
240- className = "text-black dark:text-white dark:hover:text-black"
219+ < LinkInternal
220+ iconID = { faUser }
241221 // @ts -expect-error figure `userData` shape
242222 href = { `/users/${ userData . userID } ` }
243223 >
244224 Profile page
245- </ Link >
225+ </ LinkInternal >
246226 </ Menu . Item >
247227 < Menu . Divider />
248228
249- < Menu . Item key = "upload" className = "flex flex-row gap-2" icon = { < Icon icon = { faUpload } /> } >
250- < LinkInternal href = "/account/upload" > Upload</ LinkInternal >
229+ < Menu . Item
230+ key = "upload"
231+ className = "flex flex-row gap-2"
232+ >
233+ < LinkInternal iconID = { faUpload } href = "/account/upload" > Upload</ LinkInternal >
251234 </ Menu . Item >
252235 < Menu . Divider />
253236
254237 < Menu . Item
255238 key = "archive-requests"
256- icon = {
257- < FontAwesomeIcon
258- className = "max-h-4 text-black dark:text-white"
259- icon = { faArchive }
260- />
261- }
262239 >
263- < Link
264- className = "text-black dark:text-white dark:hover:text-black"
265- href = "/archive-requests"
266- >
267- Archive Requests
268- </ Link >
240+ < LinkInternal iconID = { faArchive } href = "/archive-requests" > Archive Requests</ LinkInternal >
269241 </ Menu . Item >
270242 < Menu . Divider />
271243
@@ -275,54 +247,21 @@ function LoggedInAdminNav(props: ILoggedInAdminNav) {
275247
276248 < Menu . Item
277249 key = "password-reset"
278- icon = {
279- < FontAwesomeIcon
280- className = "max-h-4 text-black dark:text-white"
281- icon = { faKey }
282- />
283- }
284250 >
285- < Link
286- className = "text-black dark:text-white dark:hover:text-black"
287- href = "/password-reset"
288- >
289- Password Reset
290- </ Link >
251+ < LinkInternal iconID = { faKey } href = "/password-reset" > Password Reset</ LinkInternal >
291252 </ Menu . Item >
292253
293254 < Menu . Divider />
294255 < Menu . Item
295256 key = "audits"
296- icon = {
297- < FontAwesomeIcon
298- className = "max-h-4 text-black dark:text-white"
299- icon = { faArchive }
300- />
301- }
302257 >
303- < Link
304- className = "text-black dark:text-white dark:hover:text-black"
305- href = "/audits"
306- >
307- Audit Logs
308- </ Link >
258+ < LinkInternal iconID = { faArchive } href = "/audits" > Audit Logs</ LinkInternal >
309259 </ Menu . Item >
310260 < Menu . Divider />
311261 < Menu . Item
312262 key = "logout"
313- icon = {
314- < FontAwesomeIcon
315- className = "max-h-4 text-red-600"
316- icon = { faSignOutAlt }
317- />
318- }
319263 >
320- < Link
321- className = "text-black dark:text-white dark:hover:text-black"
322- href = "/logout"
323- >
324- Logout
325- </ Link >
264+ < LinkInternal iconID = { faSignOutAlt } href = "/logout" > Logout</ LinkInternal >
326265 </ Menu . Item >
327266 </ Menu >
328267 ) ;
@@ -346,12 +285,8 @@ function LoggedInAdminNav(props: ILoggedInAdminNav) {
346285function LoggedOutUserNav ( ) {
347286 return (
348287 < >
349- < Link href = "/login" >
350- < Button > Login</ Button >
351- </ Link >
352- < Link className = "ml-2" href = "/register" >
353- < Button type = "primary" > Register</ Button >
354- </ Link >
288+ < LinkInternal href = "/login" > Login</ LinkInternal >
289+ < LinkInternal href = "/register" > Register</ LinkInternal >
355290 </ >
356291 ) ;
357292}
0 commit comments