@@ -3,6 +3,11 @@ import Headroom from 'react-headroom';
3
3
import NProgress from 'nprogress' ;
4
4
import Router from 'next/router' ;
5
5
import Link from 'next/link' ;
6
+ import GoHome from 'react-icons/lib/go/home' ;
7
+ import GoBook from 'react-icons/lib/md/school' ;
8
+ import GoStar from 'react-icons/lib/md/library-books' ;
9
+ import GoCalender from 'react-icons/lib/go/calendar' ;
10
+ import GoOrg from 'react-icons/lib/go/organization' ;
6
11
7
12
import GlobalStyles from './global-styles' ;
8
13
import Head from './head' ;
@@ -29,26 +34,31 @@ export default props => {
29
34
title : 'Home' ,
30
35
path : '/' ,
31
36
external : false ,
37
+ icon : GoHome ,
32
38
} ,
33
39
{
34
40
title : 'Learn' ,
35
41
path : '/learn' ,
36
42
external : false ,
43
+ icon : GoBook ,
37
44
} ,
38
45
{
39
46
title : 'Space' ,
40
47
path : '/space' ,
41
48
external : false ,
49
+ icon : GoOrg ,
42
50
} ,
43
51
{
44
52
title : 'Events' ,
45
53
path : '/events' ,
46
54
external : false ,
55
+ icon : GoCalender ,
47
56
} ,
48
57
{
49
58
title : 'Blog' ,
50
59
path : 'https://coderplex.org/blog' ,
51
60
external : true ,
61
+ icon : GoStar ,
52
62
} ,
53
63
] ;
54
64
return (
@@ -61,6 +71,10 @@ export default props => {
61
71
< div className = "nav__logo" >
62
72
< img src = "/static/favicons/android-chrome-192x192.png" alt = "" />
63
73
</ div >
74
+ < input id = "menu" type = "checkbox" />
75
+ < label htmlFor = "menu" className = "mobile__menu" >
76
+ < span > Menu</ span >
77
+ </ label >
64
78
< ul className = "nav__links" >
65
79
{ navItems . map ( item => {
66
80
return (
@@ -72,7 +86,8 @@ export default props => {
72
86
? 'nav__link--active'
73
87
: '' } `}
74
88
>
75
- { item . title }
89
+ { React . createElement ( item . icon ) }
90
+ < span > { item . title } </ span >
76
91
</ a >
77
92
) : (
78
93
< Link href = { item . path } >
@@ -82,7 +97,8 @@ export default props => {
82
97
? 'nav__link--active'
83
98
: '' } `}
84
99
>
85
- { item . title }
100
+ { React . createElement ( item . icon ) }
101
+ < span > { item . title } </ span >
86
102
</ a >
87
103
</ Link >
88
104
) }
@@ -95,9 +111,9 @@ export default props => {
95
111
</ header >
96
112
< style jsx > { `
97
113
header {
98
- padding: 5px 20px ;
114
+ padding: 5px 10px ;
99
115
width: 100%;
100
- background: #fff ;
116
+ background: #c454df linear-gradient(to top, #ec53ab, #d354cf) ;
101
117
z-index: 1000;
102
118
}
103
119
.header__container {
@@ -106,8 +122,9 @@ export default props => {
106
122
}
107
123
nav {
108
124
display: flex;
109
- height: 70px ;
125
+ height: 56px ;
110
126
align-items: center;
127
+ position: relative;
111
128
}
112
129
.nav__logo {
113
130
flex: 1;
@@ -146,27 +163,125 @@ export default props => {
146
163
}
147
164
.nav__link {
148
165
text-decoration: none;
149
- color: #666;
150
- font-size: 14px;
166
+ color: #fff;
167
+ font-size: 16px;
168
+ font-weight: bold;
151
169
padding-bottom: 4px;
170
+ display: flex;
171
+ align-items: center;
172
+ }
173
+ .nav__link span {
174
+ margin-left: 5px;
152
175
}
153
176
.nav__link:hover {
154
- color: #444 ;
177
+ color: #e1e1e1 ;
155
178
}
156
179
.nav__link--active {
157
- color: #444;
158
- border-bottom: 2px solid #d900e4;
180
+ border-bottom: 2px solid #fff;
159
181
pointer-events: none;
160
182
}
183
+ input[type='checkbox'] {
184
+ position: absolute;
185
+ opacity: 0;
186
+ top: 25px;
187
+ left: 25px;
188
+ }
189
+ .mobile__menu {
190
+ width: 30px;
191
+ height: 24px;
192
+ display: none;
193
+ cursor: pointer;
194
+ top: 15px;
195
+ left: 5px;
196
+ position: absolute;
197
+ z-index: 1;
198
+ }
199
+ .mobile__menu:after,
200
+ .mobile__menu:before {
201
+ content: '';
202
+ width: 100%;
203
+ height: 2px;
204
+ border-radius: 4px;
205
+ position: absolute;
206
+ background: #fff;
207
+ top: 50%;
208
+ -webkit-transition: -webkit-transform 0.5s;
209
+ transition: -webkit-transform 0.5s;
210
+ transition: transform 0.5s;
211
+ transition: transform 0.5s, -webkit-transform 0.5s;
212
+ -webkit-transform-origin: 50% 50%;
213
+ transform-origin: 50% 50%;
214
+ }
215
+ .mobile__menu:after {
216
+ -webkit-transform: translate3d(0, -10px, 0) scale3d(0.8, 1, 1);
217
+ transform: translate3d(0, -10px, 0) scale3d(0.8, 1, 1);
218
+ }
219
+ .mobile__menu:before {
220
+ -webkit-transform: translate3d(0, 10px, 0) scale3d(0.8, 1, 1);
221
+ transform: translate3d(0, 10px, 0) scale3d(0.8, 1, 1);
222
+ }
223
+ .mobile__menu span {
224
+ position: absolute;
225
+ width: 100%;
226
+ overflow: hidden;
227
+ height: 2px;
228
+ border-radius: 4px;
229
+ background: #fff;
230
+ top: 50%;
231
+ -webkit-transition: all 0.5s;
232
+ transition: all 0.5s;
233
+ }
234
+ input[type='checkbox']:checked ~ .mobile__menu span {
235
+ -webkit-transform: scale3d(0, 1, 1);
236
+ transform: scale3d(0, 1, 1);
237
+ }
238
+ input[type='checkbox']:checked ~ .mobile__menu:after {
239
+ -webkit-transform: rotate3d(0, 0, 1, 45deg);
240
+ transform: rotate3d(0, 0, 1, 45deg);
241
+ }
242
+ input[type='checkbox']:checked ~ .mobile__menu:before {
243
+ -webkit-transform: rotate3d(0, 0, 1, -45deg);
244
+ transform: rotate3d(0, 0, 1, -45deg);
245
+ }
246
+ input[type='checkbox']:checked ~ .nav__links {
247
+ display: flex;
248
+ }
161
249
@media (max-width: 700px) {
162
250
nav {
163
251
justify-content: center;
164
252
}
165
253
.nav__logo {
166
254
flex: initial;
167
255
}
256
+ .mobile__menu {
257
+ display: block;
258
+ }
168
259
.nav__links {
260
+ flex-direction: column;
261
+ width: 100%;
262
+ position: fixed;
263
+ top: 66px;
264
+ background: #fafafa;
169
265
display: none;
266
+ border-bottom: 1px solid #eee;
267
+ font-size: 10px;
268
+ }
269
+ .nav__linkItem {
270
+ width: 100%;
271
+ border-top: 1px solid #eee;
272
+ }
273
+ .nav__link {
274
+ width: 100%;
275
+ font-size: 14px;
276
+ font-weight: bold;
277
+ padding: 12px 15px;
278
+ color: #888;
279
+ }
280
+ .nav__link:hover {
281
+ color: #222;
282
+ }
283
+ .nav__link--active {
284
+ border: none;
170
285
}
171
286
}
172
287
` } </ style >
0 commit comments