Skip to content

Commit 81619a4

Browse files
su-bin99rdd9223
authored andcommitted
Refactor: 헤더 nextjs로 이동
1 parent ebb4a93 commit 81619a4

9 files changed

Lines changed: 666 additions & 1 deletion

File tree

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { Link } from 'components/atoms';
2+
import { HamArrowDownIcon, HamArrowUpIcon } from 'public/assets/images';
3+
import React, { useState } from 'react';
4+
import {
5+
Detail,
6+
DetailBtn,
7+
DetailBtnContainer,
8+
DetailContainer,
9+
FakeBtn,
10+
Hide,
11+
Label,
12+
LabelIcon,
13+
Title,
14+
Wrapper,
15+
} from './style';
16+
17+
export interface IProps {
18+
className?: string;
19+
title: string;
20+
itemList: {
21+
name: string;
22+
link: string;
23+
}[];
24+
isEnglish: boolean;
25+
}
26+
27+
function HamDropDown({ title, itemList, isEnglish }: IProps): React.ReactElement {
28+
const [isOpened, setIsOpened] = useState(false);
29+
const handleOpenOnClick = (): void => {
30+
setIsOpened(!isOpened);
31+
};
32+
33+
return (
34+
<Wrapper>
35+
<Title onClick={handleOpenOnClick}>
36+
<>
37+
<Label isOpened={isOpened} isEnglish={isEnglish}>
38+
{title}
39+
</Label>
40+
<LabelIcon src={isOpened ? HamArrowUpIcon : HamArrowDownIcon} />
41+
</>
42+
</Title>
43+
{isOpened && (
44+
<Detail>
45+
<DetailContainer>
46+
<DetailBtnContainer>
47+
{itemList.map((value, id) => {
48+
return (
49+
<Link key={id} to={value.link}>
50+
<DetailBtn>{value.name}</DetailBtn>
51+
</Link>
52+
);
53+
})}
54+
<FakeBtn>_</FakeBtn>
55+
</DetailBtnContainer>
56+
<Hide></Hide>
57+
</DetailContainer>
58+
</Detail>
59+
)}
60+
</Wrapper>
61+
);
62+
}
63+
64+
export default HamDropDown;
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import { Button } from 'components/atoms';
2+
import Styled from 'styled-components';
3+
import { palette, theme } from 'styled-tools';
4+
5+
export const LabelIcon = Styled.img`
6+
width: 20px;
7+
height: 20px;
8+
margin: 0 0 0 1px;
9+
object-fit: contain;
10+
`;
11+
12+
export const Label = Styled.div<{ isOpened?: boolean; isEnglish: boolean }>`
13+
font-size: 16px;
14+
line-height: 1.25;
15+
letter-spacing: normal;
16+
text-align: left;
17+
font-family : ${(props) => (props.isEnglish ? 'HomepageBaukasten' : 'AppleSDGothicNeo')};
18+
fontWeight : ${(props) => (props.isOpened ? 'bold' : 'normal')};
19+
:hover{
20+
font-weight: bold;
21+
}
22+
`;
23+
24+
export const Title = Styled(Button)`
25+
display : flex;
26+
align-items : center;
27+
justify-content : center;
28+
color : ${palette('grayscale', 7)};
29+
`;
30+
31+
export const Detail = Styled.div`
32+
width : 100%;
33+
display : flex;
34+
justify-content:center;
35+
`;
36+
37+
export const DetailContainer = Styled.div`
38+
width : 200px;
39+
display : flex;
40+
flex-direction : column;
41+
align-items : center;
42+
position : relative;
43+
margin-top : 20px;
44+
`;
45+
46+
export const DetailBtnContainer = Styled.div`
47+
width : 200px;
48+
display : flex;
49+
flex-direction : column;
50+
max-height : 229px;
51+
overflow-y: scroll;
52+
align-items : center;
53+
::-webkit-scrollbar {
54+
width: 0.3rem;
55+
}
56+
::-webkit-scrollbar-track {
57+
background: none;
58+
}
59+
::-webkit-scrollbar-thumb {
60+
background: ${palette('grayscale', 2)};
61+
border-radius: 0.5rem;
62+
box-sizing: border-box;
63+
}
64+
::-webkit-scrollbar-thumb:hover {
65+
background: ${palette('grayscale', 2)};
66+
}
67+
`;
68+
69+
export const DetailBtn = Styled(Button)`
70+
${theme('font.body2_eng')}
71+
height: 18px;
72+
margin: 5px 0;
73+
color : ${palette('grayscale', 4)};
74+
white-space: nowrap;
75+
:hover{
76+
${theme('font.subhead2_eng')};
77+
}
78+
`;
79+
80+
export const FakeBtn = Styled(Button)`
81+
color : rgba(0,0,0,0);
82+
line-height : 30px;
83+
`;
84+
85+
export const Hide = Styled.div`
86+
width : 100%;
87+
height : 36px;
88+
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0), ${palette('grayscale', 0)});
89+
position : absolute;
90+
bottom : 0px;
91+
`;
92+
93+
export const Wrapper = Styled.div`
94+
display : flex;
95+
flex-direction: column;
96+
align-items : center;
97+
justify-content : center;
98+
`;

components/molecules/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export { default as EditorForm } from './EditorForm';
3030
export { default as FindPwdForm } from './FindPwdForm';
3131
export { default as FindPwdModal } from './FindPwdModal';
3232
export { default as FormInput } from './FormInput';
33+
export { default as HamDropDown } from './HamDropDown';
3334
export { default as LoginModal } from './LoginModal';
3435
export { default as MyPageConcertCard } from './MyPageConcertCard';
3536
export { default as MyPageSection } from './MyPageSection';

0 commit comments

Comments
 (0)