11'use client' ;
22
33import { useMutation , useQuery , useQueryClient } from '@tanstack/react-query' ;
4- import { usePathname } from 'next/navigation' ;
4+ import { usePathname , useRouter } from 'next/navigation' ;
55import { useEffect , useRef , useState } from 'react' ;
66import Image from 'next/image' ;
77import { revalidate } from '@/utils/revalidateUtil' ;
@@ -33,7 +33,8 @@ export const Header = () => {
3333 const { open : ModalOpen } = useModal ( ) ;
3434 const menu = useRef < HTMLDivElement | null > ( null ) ;
3535 const path = usePathname ( ) ;
36- const { replace } = useCustomNavigation ( ) ;
36+ const { replace, start } = useCustomNavigation ( ) ;
37+ const { replace : replaceWithoutLoading } = useRouter ( ) ;
3738 const width = useResponsive ( ) ;
3839 const barWidth = width < SCREENS . MBI ? 65 : 180 ;
3940 const client = useQueryClient ( ) ;
@@ -57,10 +58,7 @@ export const Header = () => {
5758
5859 useEffect ( ( ) => {
5960 const handleClickOutside = ( e : MouseEvent ) =>
60- open &&
61- menu . current &&
62- ! menu . current . contains ( e . target as HTMLElement ) &&
63- setOpen ( false ) ;
61+ open && menu . current && ! menu . current . contains ( e . target as HTMLElement ) && setOpen ( false ) ;
6462
6563 document . addEventListener ( 'mousedown' , handleClickOutside ) ;
6664 return ( ) => document . removeEventListener ( 'mousedown' , handleClickOutside ) ;
@@ -69,20 +67,9 @@ export const Header = () => {
6967 return (
7068 < nav className = "w-full max-MBI:flex max-MBI:justify-center" >
7169 < div className = "flex w-fit" >
72- < Section
73- clickType = "function"
74- action = { ( ) => replace ( `/main${ PARAMS . MAIN } ` ) }
75- >
76- < Image
77- width = { 35 }
78- height = { 35 }
79- src = { '/favicon.png' }
80- className = "transition-all"
81- alt = ""
82- />
83- < span className = "text-TEXT-MAIN text-T4 max-TBL:hidden" >
84- Velog Dashboard
85- </ span >
70+ < Section clickType = "function" action = { ( ) => replaceWithoutLoading ( `/main${ PARAMS . MAIN } ` ) } >
71+ < Image width = { 35 } height = { 35 } src = { '/favicon.png' } className = "transition-all" alt = "" />
72+ < span className = "text-TEXT-MAIN text-T4 max-TBL:hidden" > Velog Dashboard</ span >
8673 </ Section >
8774 < div className = "flex w-fit relative" >
8875 < div
@@ -92,12 +79,7 @@ export const Header = () => {
9279 className = { `${ defaultStyle } h-[2px_!important] bg-TEXT-MAIN absolute bottom-0 left-0` }
9380 />
9481 { layouts . map ( ( i ) => (
95- < Section
96- key = { i . title }
97- clickType = "link"
98- icon = { i . icon }
99- action = { i . path }
100- >
82+ < Section key = { i . title } clickType = "link" icon = { i . icon } action = { i . path } >
10183 { i . title }
10284 </ Section >
10385 ) ) }
@@ -122,7 +104,10 @@ export const Header = () => {
122104 < div className = "cursor-pointer h-fit flex-col rounded-[4px] bg-BG-SUB shadow-BORDER-MAIN shadow-md" >
123105 < button
124106 className = "text-DESTRUCTIVE-SUB text-I3 p-5 max-MBI:p-4 flex whitespace-nowrap w-auto hover:bg-BG-ALT"
125- onClick = { ( ) => out ( ) }
107+ onClick = { ( ) => {
108+ start ( ) ;
109+ out ( ) ;
110+ } }
126111 >
127112 로그아웃
128113 </ button >
0 commit comments