Skip to content

Commit

Permalink
Merge pull request #297 from boostcampwm-2024/dev-front
Browse files Browse the repository at this point in the history
[FE] Navbar 토글시 영역이 남아있던 현상 수정
  • Loading branch information
Hosung99 authored Dec 5, 2024
2 parents 3c4217d + 06a7fb4 commit 5426113
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions frontend/src/component/template/NabvarLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@ export default function NavbarLayout() {
}

return (
<div
className='relative h-screen w-[20%] rounded-[11px] bg-lightblue dark:bg-darkblue'
<motion.div
animate={{
width: isNavbarOpen ? '20%' : '0%'
}}
transition={{ duration: 0.3, ease: 'easeInOut' }}
className='relative h-screen rounded-[11px] bg-lightblue dark:bg-darkblue'
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}>
<AnimatePresence>
{isNavbarOpen && (
<motion.div
initial={{ width: 0, opacity: 0, x: -50 }}
animate={{ width: '100%', opacity: 1, x: 0 }}
exit={{ width: 0, opacity: 0, x: -50 }}
initial={{ opacity: 0, x: -50 }}
animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: -50 }}
transition={{ duration: 0.3, ease: 'easeInOut' }}>
<Navbar />
{isHovered && (
Expand Down Expand Up @@ -57,6 +61,6 @@ export default function NavbarLayout() {
<ChevronRight size={20} />
</motion.button>
)}
</div>
</motion.div>
);
}

0 comments on commit 5426113

Please sign in to comment.