Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev into prod #117

Merged
merged 23 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
534003a
Add childcare page
oleveloper Jul 22, 2023
0501d26
fix: Simplify code for childcare page
oleveloper Jul 23, 2023
b39f197
fix: 시간표에서 필요없는 연산 삭제
NaGyeong-Park Jul 25, 2023
2d09e7c
chore: fix router section
NaGyeong-Park Jul 25, 2023
a019e8c
feat: 모바일 네비게이션 바
NaGyeong-Park Jul 25, 2023
6a24d98
chore: add dropdown icon
NaGyeong-Park Jul 25, 2023
d20c870
chore: change old logo to new logo
NaGyeong-Park Jul 25, 2023
037b63f
style: 기존 네비게이션 스타일 변경
NaGyeong-Park Jul 27, 2023
4ecdabb
feat: DescktopMenu Link/Section
NaGyeong-Park Jul 27, 2023
9902cd4
feat: DropDown'
NaGyeong-Park Jul 27, 2023
25ba0a1
chore: route constant 수정
NaGyeong-Park Jul 27, 2023
43fdd23
fix: NavBar
NaGyeong-Park Jul 27, 2023
e61992a
fix: NavBarMobile
NaGyeong-Park Jul 27, 2023
2a32310
chore: 안쓰는 라우터 삭제
NaGyeong-Park Jul 27, 2023
861048a
fix: 모바일 네비게이션바 스크롤되게 수정
NaGyeong-Park Jul 27, 2023
434bede
chore: delete useless icon
NaGyeong-Park Jul 27, 2023
6073533
chore: delete useless import
NaGyeong-Park Jul 28, 2023
dd50de7
fix: 상단 네브바 고정
NaGyeong-Park Jul 28, 2023
e8fec93
Merge branch 'pythonkr:prod' into feature/dropdown-menu
NaGyeong-Park Jul 28, 2023
17c9387
Merge pull request #114 from NaGyeong-Park/feature/dropdown-menu
gollumnima Jul 28, 2023
8c494af
Merge branch 'dev' into feature/childcare
oleveloper Jul 29, 2023
db1299a
Add childcare program to dropdown
oleveloper Jul 29, 2023
72d7bd4
Merge pull request #95 from oleveloper/feature/childcare
oleveloper Jul 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions components/common/DesktopMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { RouteType } from '@/interfaces/RouteType';
import { styled } from '@stitches/react';
import MenuDropdown from './MenuDropdown';
import { useState } from 'react';
import Link from 'next/link';

const SectionWrapper = styled('div', {
listStyle: 'none',
padding: '0.5rem',
position: 'relative',
});

const SectionTitleWrapper = styled('div', {
display: 'flex',
alignItems: 'center',
gap: '8px',
});
const MenuItem = styled('span', {
fontWeight: 700,
color: '$textPrimary',
fontSize: '24px',
lineHeight: '24px',
whiteSpace: 'nowrap',
});

const LinkMenu = ({ title, route }: { title: string; route: string }) => {
return (
<SectionWrapper>
<Link href={route}>
<SectionTitleWrapper>
<MenuItem>{title}</MenuItem>
</SectionTitleWrapper>
</Link>
</SectionWrapper>
);
};

const SectionMenu = ({
label,
items,
}: {
label: string;
items: RouteType[];
}) => {
const [show, setShow] = useState(false);
return (
<SectionWrapper
onMouseOver={() => setShow(true)}
onMouseLeave={() => setShow(false)}
>
<SectionTitleWrapper>
<MenuItem>{label}</MenuItem>
</SectionTitleWrapper>
{show && <MenuDropdown items={items} />}
</SectionWrapper>
);
};

const DesktopMenu = {
Section: SectionMenu,
Link: LinkMenu,
};

export default DesktopMenu;
45 changes: 45 additions & 0 deletions components/common/MenuDropdown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { RouteType } from '@/interfaces/RouteType';
import { styled } from '@stitches/react';
import Link from 'next/link';

const DropDownMenu = styled('div', {
position: 'absolute',
backgroundColor: '$backgroundPrimary',
});

const MenuContainer = styled('div', {
paddingTop: '1rem',
display: 'flex',
flexDirection: 'column',
});

const MenuItem = styled('span', {
fontWeight: 600,
color: '$textSecondary',
fontSize: '16px',
lineHeight: '24px',
'&:hover': {
color: '$textPrimary',
},
});
const StyledMenu = styled('div', {
display: 'inline-block',
padding: '0.25rem 0',
});

export const MenuDropdown = ({ items }: { items: RouteType[] }) => {
return (
<DropDownMenu>
<MenuContainer>
{items.map((menu) => (
<StyledMenu key={menu.route}>
<Link href={menu.route} passHref>
<MenuItem>{menu.title}</MenuItem>
</Link>
</StyledMenu>
))}
</MenuContainer>
</DropDownMenu>
);
};
export default MenuDropdown;
59 changes: 22 additions & 37 deletions components/layout/NavBar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { useCallback, useEffect, useState } from 'react';
import { styled } from 'stitches.config';
import Link from 'next/link';
import { NavBarMenus, Routes } from '@/constants/routes';
import { SectionMenu, Routes, LinkMenu } from '@/constants/routes';
import { StyledButton } from '../common/Button';
import DesktopMenu from '../common/DesktopMenu';
import { Logo as LogoSvg } from '@/public/icons';
import ThemeSwitch from '../ThemeSwitch';
import NavBarMobile from './NavBarMobile';
Expand All @@ -12,35 +13,32 @@ import { useRouter } from 'next/router';
import { signOut } from '@/api/login';

const StyledNavArea = styled('div', {
position: 'fixed',
display: 'flex',
justifyContent: 'space-between',
gap: 40,
alignItems: 'center',
backgroundColor: '$backgroundPrimary',
width: '100%',
width: 'calc(100% - 40px)',
margin: '0 auto',
paddingRight: '30px',
zIndex: '99',

'@bp1': {
position: 'fixed',
height: '44px',
},
'@bp2': {
padding: '1rem 2rem',
padding: '1rem',
height: '80px',
},
});

const Logo = styled(LogoSvg, {
display: 'block',
width: 230,
width: 114,
'& path': {
fill: '$textPrimary',
},

'@bp2': {
maxWidth: 230,
},
});

const Title = styled('h1', {
Expand All @@ -54,34 +52,14 @@ const Title = styled('h1', {
const NavContainer = styled('div', {
display: 'none',
'@bp2': {
display: 'flex',
display: 'contents',
},
});

const MenuItem = styled('span', {
fontWeight: 700,
color: '$textPrimary',
fontSize: '24px',
lineHeight: '24px',
});

const StyledMenuBox = styled('div', {
display: 'flex',
flex: 1,
alignItems: 'center',
padding: '0 60px',
gap: '32px',
});

const StyledMenu = styled('div', {
display: 'inline-block',

'@bp1': {
padding: '0',
},
'@bp2': {
padding: '0 1.5rem',
},
gap: '40px',
});

const SideBox = styled('div', {
Expand Down Expand Up @@ -129,12 +107,19 @@ const NavBar = () => {
<NavBarMobile />
<NavContainer>
<StyledMenuBox>
{NavBarMenus.map((menu) => (
<StyledMenu key={menu.route}>
<Link href={menu.route} passHref>
<MenuItem>{menu.title}</MenuItem>
</Link>
</StyledMenu>
{SectionMenu.map((section) => (
<DesktopMenu.Section
key={section.label}
label={section.label}
items={section.items}
/>
))}
{LinkMenu.map((menu) => (
<DesktopMenu.Link
key={menu.route}
title={menu.title}
route={menu.route}
/>
))}
</StyledMenuBox>
<SideBox>
Expand Down
65 changes: 52 additions & 13 deletions components/layout/NavBarMobile.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MobileNavBarMenus } from '@/constants/routes';
import { LinkMenu, SectionMenu } from '@/constants/routes';
import { styled } from '@/stitches.config';
import Link from 'next/link';
import { useRouter } from 'next/router';
Expand All @@ -21,40 +21,59 @@ const Container = styled('div', {
});

const ForeGroundContainer = styled('div', {
overflow: 'scroll',
position: 'fixed',
top: '44px',
left: '0',
width: '100%',
height: '100%',
backgroundColor: 'rgba(0, 0, 0, 0.8)',
backgroundColor: '$backgroundPrimary',
zIndex: '100',
padding: '1.5rem',
paddingBottom: '3rem',
});

const MenuContainer = styled('div', {
backgroundColor: '$backgroundPrimary',
display: 'flex',
flexDirection: 'column',
});

const MenuWrapper = styled('ul', {
listStyle: 'none',
padding: '0.5rem',
});

const MenuList = styled('li', {
display: 'flex',
flexDirection: 'column',
justifyContent: 'space-between',
gap: '8px',
padding: '8px 8px 8px 16px',
padding: '8px 0',
zIndex: '1000',
color: '$textPrimary',
backgroundColor: '$backgroundPrimary',
borderTop: '1px solid $textPrimary',
});

const MenuItem = styled('span', {
const SectionItem = styled('span', {
fontWeight: 700,
color: '$textPrimary',
fontSize: '24px',
lineHeight: '28px',
display: 'inline-block',
padding: '8px 0',
});

const MenuItemWrapper = styled('div', {
display: 'flex',
justifyContent: 'space-between',
});

const MenuItem = styled('span', {
fontWeight: 700,
color: '$textPrimary',
fontSize: '18px',
lineHeight: '28px',
});

const MenuIconWrapper = styled('div', {
Expand All @@ -81,6 +100,10 @@ const IconWrapper = styled('div', {
height: '32px',
});

const Divider = styled('hr', {
borderTop: '1px solid $textPrimary',
});

const NavBarMobile = () => {
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
const { resolvedTheme } = useTheme();
Expand Down Expand Up @@ -117,16 +140,32 @@ const NavBarMobile = () => {
{isMobileMenuOpen && (
<ForeGroundContainer onClick={handleMobileMenuClick}>
<MenuContainer>
<MenuWrapper>
{MobileNavBarMenus.map((menu) => (
<Link key={menu.route} href={menu.route} passHref>
<MenuList>
<MenuItem>{menu.title}</MenuItem>
{SectionMenu.map((section) => (
<MenuWrapper key={section.label}>
<SectionItem>{section.label}</SectionItem>
<Divider />
<MenuList>
{section.items.map((menu) => (
<Link key={menu.route} href={menu.route} passHref>
<MenuItemWrapper>
<MenuItem>{menu.title}</MenuItem>
<LinkArrowIcon width="28" height="28" />
</MenuItemWrapper>
</Link>
))}
</MenuList>
</MenuWrapper>
))}
{LinkMenu.map((menu) => (
<MenuWrapper key={menu.title}>
<Link key={menu.route} href={menu.route}>
<MenuItemWrapper>
<SectionItem>{menu.title}</SectionItem>
<LinkArrowIcon width="28" height="28" />
</MenuList>
</MenuItemWrapper>
</Link>
))}
</MenuWrapper>
</MenuWrapper>
))}
</MenuContainer>
</ForeGroundContainer>
)}
Expand Down
Loading
Loading