Skip to content

Commit 4b39025

Browse files
committed
모바일 페이지에서 라우트 변경시 메뉴탭 닫히도록 수정
1 parent 718a39d commit 4b39025

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

frontend/components/core/NavBarMobile.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from 'react'
1+
import React, { useEffect, useState } from 'react'
22
import { routes, RouteType } from '../../routes/routes'
33
import styled from 'styled-components'
44
import { useTranslation } from 'react-i18next'
@@ -192,6 +192,10 @@ const NavBarMobile = (props: NavProps) => {
192192
router.push(router.asPath, undefined, { locale: lang })
193193
}
194194

195+
useEffect(() => {
196+
setIsMenuOpen(false)
197+
}, [router.pathname])
198+
195199
return (
196200
<Container isTransparent={isHome}>
197201
<HomeLink href="/">

0 commit comments

Comments
 (0)