Skip to content

Commit d267f09

Browse files
committed
feat: 모바일 내비게이션에서 자식 메뉴가 있는 경우 버튼으로 변경
1 parent d400f5e commit d267f09

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

apps/pyconkr/src/components/layout/Header/Mobile/MobileNavigation.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,15 @@ export const MobileNavigation: React.FC<MobileNavigationProps> = ({ isOpen, onCl
8787
.filter((s) => !s.hide)
8888
.map((menu) => (
8989
<MenuItem isMainPath={isMainPath} key={menu.id}>
90-
<MenuLink isMainPath={isMainPath} to={menu.route_code} onClick={handleClose}>
91-
{menu.name}
92-
</MenuLink>
90+
{!R.isEmpty(menu.children) && Object.values(menu.children).some((child) => !child.hide) ? (
91+
<MenuButton isMainPath={isMainPath} onClick={() => navigateToDepth2(menu)}>
92+
{menu.name}
93+
</MenuButton>
94+
) : (
95+
<MenuLink isMainPath={isMainPath} to={menu.route_code} onClick={handleClose}>
96+
{menu.name}
97+
</MenuLink>
98+
)}
9399
{!R.isEmpty(menu.children) && Object.values(menu.children).some((child) => !child.hide) && (
94100
<MenuArrowButton isMainPath={isMainPath} onClick={() => navigateToDepth2(menu)}>
95101
<ArrowForward fontSize="small" />
@@ -250,6 +256,17 @@ const MenuLink = styled(Link)<{ isMainPath?: boolean }>(({ theme, isMainPath = t
250256
fontWeight: 600,
251257
}));
252258

259+
const MenuButton = styled(Button)<{ isMainPath?: boolean }>(({ theme, isMainPath = true }) => ({
260+
color: isMainPath ? theme.palette.mobileNavigation.main.text : theme.palette.mobileNavigation.sub.text,
261+
textTransform: "none",
262+
fontSize: "20px",
263+
fontWeight: 600,
264+
padding: 0,
265+
minWidth: "auto",
266+
minHeight: "auto",
267+
justifyContent: "flex-start",
268+
}));
269+
253270
const MenuArrowButton = styled(IconButton)<{ isMainPath?: boolean }>(({ theme, isMainPath = true }) => ({
254271
color: isMainPath ? theme.palette.mobileNavigation.main.text : theme.palette.mobileNavigation.sub.text,
255272
padding: 8,

0 commit comments

Comments
 (0)