@@ -4,9 +4,10 @@ import Close from '@/shared/assets/icons/close_32.svg';
44import User from '@/shared/assets/icons/user_24.svg' ;
55import Link from 'next/link' ;
66import { usePathname } from 'next/navigation' ;
7- import { useEffect , useRef , useState } from 'react' ;
7+ import { useEffect , useRef } from 'react' ;
88import gsap from 'gsap' ;
99import { useAuthStore } from '@/shared/@store/auth' ;
10+ import { createPortal } from 'react-dom' ;
1011
1112interface Props {
1213 isClicked : boolean ;
@@ -54,29 +55,29 @@ function DropdownMenu({ isClicked, setIsClicked, visible, setVisible }: Props) {
5455 } ;
5556 } , [ isClicked ] ) ;
5657
57- const handleMouseEnter = ( index : number ) => {
58- const el = textRef . current [ index ] ;
59- if ( ! el ) return ;
60- gsap . to ( el , {
61- y : - 5 ,
62- duration : 0.3 ,
63- ease : 'power1.out' ,
64- } ) ;
65- } ;
58+ // const handleMouseEnter = (index: number) => {
59+ // const el = textRef.current[index];
60+ // if (!el) return;
61+ // gsap.to(el, {
62+ // y: -5,
63+ // duration: 0.3,
64+ // ease: 'power1.out',
65+ // });
66+ // };
6667
67- const handleMouseLeave = ( index : number ) => {
68- const el = textRef . current [ index ] ;
69- if ( ! el ) return ;
70- gsap . to ( el , {
71- y : 0 ,
72- duration : 0.3 ,
73- ease : 'power1.out' ,
74- } ) ;
75- } ;
68+ // const handleMouseLeave = (index: number) => {
69+ // const el = textRef.current[index];
70+ // if (!el) return;
71+ // gsap.to(el, {
72+ // y: 0,
73+ // duration: 0.3,
74+ // ease: 'power1.out',
75+ // });
76+ // };
7677
77- return (
78+ return createPortal (
7879 < nav
79- className = { `w-full h-screen bg-secondary absolute top-0 left-0 px-[12px] font-serif block sm:hidden ${ visible ? 'block' : 'hidden' } ` }
80+ className = { `w-full h-full z-1000 bg-secondary absolute top-0 left-0 px-[12px] font-serif block sm:hidden ${ visible ? 'block' : 'hidden' } ` }
8081 role = "navigation"
8182 aria-label = "메인 네비게이션 메뉴"
8283 tabIndex = { - 1 }
@@ -94,7 +95,10 @@ function DropdownMenu({ isClicked, setIsClicked, visible, setVisible }: Props) {
9495 </ div >
9596 < ul className = "flex flex-col gap-[12px] text-black px-2 my-5" >
9697 { navItem . map ( ( { label, href } , idx ) => (
97- < li className = { `font-normal ${ pathname === href ? 'pl-1' : 'px-3 py-[12px]' } ` } key = { href } >
98+ < li
99+ className = { `font-normal transition-colors duration-300 ease-in-out ${ pathname === href ? 'pl-1' : 'px-3 py-[12px]' } ` }
100+ key = { href }
101+ >
98102 < Link
99103 href = { href }
100104 onNavigate = { ( ) => setIsClicked ( false ) }
@@ -107,8 +111,8 @@ function DropdownMenu({ isClicked, setIsClicked, visible, setVisible }: Props) {
107111 ref = { ( el ) => {
108112 textRef . current [ idx ] = el ;
109113 } }
110- onMouseEnter = { ( ) => handleMouseEnter ( idx ) }
111- onMouseLeave = { ( ) => handleMouseLeave ( idx ) }
114+ // onMouseEnter={() => handleMouseEnter(idx)}
115+ // onMouseLeave={() => handleMouseLeave(idx)}
112116 >
113117 { label }
114118 </ span >
@@ -153,7 +157,8 @@ function DropdownMenu({ isClicked, setIsClicked, visible, setVisible }: Props) {
153157 < Close color = "var(--color-primary)" className = "w-8 h-8" aria-hidden />
154158 </ button >
155159 </ div >
156- </ nav >
160+ </ nav > ,
161+ document . body
157162 ) ;
158163}
159164
0 commit comments