Skip to content

Commit

Permalink
fix: Navigation bar 요소 클릭 시 자동으로 메뉴 바 닫히도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
junyeokk committed May 12, 2024
1 parent efea621 commit 636b9ee
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/components/navigation/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ const itemVariants: Variants = {
const Navigation: React.FC = () => {
const [show, setShow] = useState(false);
const navigate = useNavigate();
const handleNavLinkClick = (path: string) => {
setShow(false);
navigate(path);
};

return (
<StyledNav>
Expand All @@ -48,16 +52,16 @@ const Navigation: React.FC = () => {
</NavHeader>
<motion.ul initial="closed" animate={show ? "open" : "closed"} variants={listVariants}>
<NavItem variants={itemVariants}>
<NavLink onClick={() => navigate("/booth")}>부스 별 지도</NavLink>
<NavLink onClick={() => handleNavLinkClick("/booth")}>부스 별 지도</NavLink>
</NavItem>
<NavItem variants={itemVariants}>
<NavLink onClick={() => navigate("/guests")}>Special Guest</NavLink>
<NavLink onClick={() => handleNavLinkClick("/guests")}>Special Guest</NavLink>
</NavItem>
<NavItem variants={itemVariants}>
<NavLink onClick={() => navigate("/timetable")}>이벤트 일정</NavLink>
<NavLink onClick={() => handleNavLinkClick("/timetable")}>이벤트 일정</NavLink>
</NavItem>
<NavItem variants={itemVariants}>
<NavLink onClick={() => navigate("/contributors")}>만든이들</NavLink>
<NavLink onClick={() => handleNavLinkClick("/contributors")}>만든이들</NavLink>
</NavItem>
</motion.ul>
</StyledNav>
Expand Down

0 comments on commit 636b9ee

Please sign in to comment.