Header.js
4.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
import React, { useState } from 'react';
import { NavLink, useHistory } from 'react-router-dom';
import { FaSearch } from 'react-icons/fa';
import styled from 'styled-components';
import InputBlock from './common/Input';
import DropDownButton from './common/DropdownButton';
import Button from './common/Button';
import Modal from './SearchOptionModal';
import palette from '../lib/styles/palette';
// 헤더 사이즈
const HeaderHeight = '170px';
const HeaderTop = styled.div`
background-color: black;
float: up;
height: 20px;
`;
const MainContainer = styled.div`
height: ${HeaderHeight};
position: fixed;
top: 0;
width: 100%;
z-index: 999;
background-color: white;
border-bottom: 1px solid ${palette.gray4};
`;
const MenuContainer = styled.div`
position: absolute;
top: 96px;
left: 0px;
`;
const LogoContainer = styled.div`
margin-top: 10px;
float: left;
padding: 20px;
img {
width: 130px;
vertical-align: bottom;
}
cursor: pointer;
`;
const SearchContainer = styled.div`
margin-top: 20px;
`;
const SLink = styled(NavLink)`
list-style-type: none;
color: black;
float: left;
line-height: 55px;
vertical-align: middle;
text-align: center;
padding-left: 2em;
padding-right: 2em;
text-decoration: none !important;
&:hover {
background-color: ${palette.gray4};
border-bottom: 3px solid ${palette.gray4};
}
&.active {
font-weight: 600;
border-bottom: 3px solid ${palette.gray6};
float: left;
line-height: 55px;
vertical-align: middle;
text-align: center;
padding-left: 2em;
padding-right: 2em;
color: black;
text-decoration: none !important;
}
`;
const DropDownWrap = styled.div``;
const SearchOptionContainer = styled.div`
float: left;
`;
const SortOptionContainer = styled.div`
float: left;
`;
const OptionContainer = styled.div`
position: absolute;
top: 132px;
left: 750px;
`;
const UserContainer = styled.div`
position: fixed;
top: 35px;
right: 0;
padding-right: 20px;
`;
const AirContainer = styled.div`
height: ${HeaderHeight};
`;
const DropDownContainer = styled.div`
flex-direction: column;
`;
const Header = () => {
const [showModal, setShowModal] = useState(false);
const openModal = () => {
setShowModal(prev => !prev);
};
const history = useHistory();
const onMainClick = () => {
history.push('');
};
return (
<>
<MainContainer>
<HeaderTop />
<LogoContainer onClick={onMainClick}>
<img src="eDrive_logo_v2.png" alt="" />
</LogoContainer>
<SearchContainer>
<DropDownContainer>
<DropDownWrap>
<DropDownButton
menuPosition={{ top: 40 }}
size={100}
color="blue"
float="left"
fontsize="20px"
height="50px"
options={[{ id: 1, name: '전체' }]}
/>
</DropDownWrap>
</DropDownContainer>
<InputBlock color="blue" fontsize="20px" width="850px" display="" />
</SearchContainer>
<MenuContainer>
<ul>
<SLink activeClassName="active" to="/search">
전체
</SLink>
</ul>
</MenuContainer>
<OptionContainer>
<SortOptionContainer>
<DropDownButton
color="white"
width="100px"
fontsize="15px"
height="36px"
title="정렬(기본)"
menuPosition={{ top: 29 }}
size="100"
options={[
{ id: 0, name: '정렬(기본)' },
{ id: 1, name: '날짜빠른순' },
{ id: 2, name: '크기높은순' },
{ id: 3, name: '크기낮은순' },
]}
/>{' '}
</SortOptionContainer>
<SearchOptionContainer onClick={openModal}>
<Button color="gray" size="md" icon={<FaSearch />}>
고급 검색
</Button>
</SearchOptionContainer>
<Modal showModal={showModal} setShowModal={setShowModal} />
</OptionContainer>
<UserContainer>
<Button color="blue" width="100px" height="50px" fontsize="20px">
사용자 님
</Button>
</UserContainer>
</MainContainer>
<AirContainer />
</>
);
};
export default Header;