Skip to content
This repository was archived by the owner on Mar 9, 2021. It is now read-only.

Commit 62746df

Browse files
vinaypuppalZubair Ahmed
authored and
Zubair Ahmed
committed
Mobile menu (#68)
* implement mobile menu, fix few padding issue and change some colors * fix mobile hover color issue * some more color changes * move menu icon more to left * added production cdn links to serving md files * menu highlight color slighlt changed from yellow
1 parent 3d94387 commit 62746df

File tree

8 files changed

+167
-43
lines changed

8 files changed

+167
-43
lines changed

components/common-banner.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default props => (
99
<style jsx>{`
1010
.root {
1111
background-color: #f4f7fb;
12-
min-height: 200px;
12+
min-height: 150px;
1313
text-align: center;
1414
}
1515
.headline {
@@ -18,6 +18,20 @@ export default props => (
1818
color: #df1cb5;
1919
font-weight: 900;
2020
}
21+
h2 {
22+
max-width: 1024px;
23+
margin-left: auto;
24+
margin-right: auto;
25+
letter-spacing: 2px;
26+
line-height: 2;
27+
margin-bottom: 30px;
28+
}
29+
@media (max-width: 720px) {
30+
h2 {
31+
font-size: 14px;
32+
padding: 0 10px;
33+
}
34+
}
2135
`}</style>
2236
</div>
2337
);

components/footer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default () => (
3939
<style jsx>{`
4040
footer {
4141
padding: 50px 0;
42-
background: #314159;
42+
background: #c454df linear-gradient(to bottom, #ec53ab, #d354cf);
4343
color: #fff;
4444
}
4545
.footer__container {

components/global-styles.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default () => (
2727
pointer-events: none;
2828
}
2929
#nprogress .bar {
30-
background: #d812c8;
30+
background: #f9d1ed;
3131
position: fixed;
3232
z-index: 1031;
3333
top: 0;
@@ -42,7 +42,7 @@ export default () => (
4242
right: 0px;
4343
width: 100px;
4444
height: 100%;
45-
box-shadow: 0 0 10px #d812c8, 0 0 5px #d812c8;
45+
box-shadow: 0 0 10px #f9d1ed, 0 0 5px #f9d1ed;
4646
opacity: 1;
4747
transform: rotate(3deg) translate(0px, -4px);
4848
}

components/header.js

Lines changed: 125 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import Headroom from 'react-headroom';
33
import NProgress from 'nprogress';
44
import Router from 'next/router';
55
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';
611

712
import GlobalStyles from './global-styles';
813
import Head from './head';
@@ -29,26 +34,31 @@ export default props => {
2934
title: 'Home',
3035
path: '/',
3136
external: false,
37+
icon: GoHome,
3238
},
3339
{
3440
title: 'Learn',
3541
path: '/learn',
3642
external: false,
43+
icon: GoBook,
3744
},
3845
{
3946
title: 'Space',
4047
path: '/space',
4148
external: false,
49+
icon: GoOrg,
4250
},
4351
{
4452
title: 'Events',
4553
path: '/events',
4654
external: false,
55+
icon: GoCalender,
4756
},
4857
{
4958
title: 'Blog',
5059
path: 'https://coderplex.org/blog',
5160
external: true,
61+
icon: GoStar,
5262
},
5363
];
5464
return (
@@ -61,6 +71,10 @@ export default props => {
6171
<div className="nav__logo">
6272
<img src="/static/favicons/android-chrome-192x192.png" alt="" />
6373
</div>
74+
<input id="menu" type="checkbox" />
75+
<label htmlFor="menu" className="mobile__menu">
76+
<span>Menu</span>
77+
</label>
6478
<ul className="nav__links">
6579
{navItems.map(item => {
6680
return (
@@ -72,7 +86,8 @@ export default props => {
7286
? 'nav__link--active'
7387
: ''}`}
7488
>
75-
{item.title}
89+
{React.createElement(item.icon)}
90+
<span>{item.title}</span>
7691
</a>
7792
) : (
7893
<Link href={item.path}>
@@ -82,7 +97,8 @@ export default props => {
8297
? 'nav__link--active'
8398
: ''}`}
8499
>
85-
{item.title}
100+
{React.createElement(item.icon)}
101+
<span>{item.title}</span>
86102
</a>
87103
</Link>
88104
)}
@@ -95,9 +111,9 @@ export default props => {
95111
</header>
96112
<style jsx>{`
97113
header {
98-
padding: 5px 20px;
114+
padding: 5px 10px;
99115
width: 100%;
100-
background: #fff;
116+
background: #c454df linear-gradient(to top, #ec53ab, #d354cf);
101117
z-index: 1000;
102118
}
103119
.header__container {
@@ -106,8 +122,9 @@ export default props => {
106122
}
107123
nav {
108124
display: flex;
109-
height: 70px;
125+
height: 56px;
110126
align-items: center;
127+
position: relative;
111128
}
112129
.nav__logo {
113130
flex: 1;
@@ -146,27 +163,125 @@ export default props => {
146163
}
147164
.nav__link {
148165
text-decoration: none;
149-
color: #666;
150-
font-size: 14px;
166+
color: #fff;
167+
font-size: 16px;
168+
font-weight: bold;
151169
padding-bottom: 4px;
170+
display: flex;
171+
align-items: center;
172+
}
173+
.nav__link span {
174+
margin-left: 5px;
152175
}
153176
.nav__link:hover {
154-
color: #444;
177+
color: #e1e1e1;
155178
}
156179
.nav__link--active {
157-
color: #444;
158-
border-bottom: 2px solid #d900e4;
180+
border-bottom: 2px solid #fff;
159181
pointer-events: none;
160182
}
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+
}
161249
@media (max-width: 700px) {
162250
nav {
163251
justify-content: center;
164252
}
165253
.nav__logo {
166254
flex: initial;
167255
}
256+
.mobile__menu {
257+
display: block;
258+
}
168259
.nav__links {
260+
flex-direction: column;
261+
width: 100%;
262+
position: fixed;
263+
top: 66px;
264+
background: #fafafa;
169265
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;
170285
}
171286
}
172287
`}</style>

pages/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class Home extends React.Component {
209209
}
210210
.about__container {
211211
padding-bottom: 30px;
212-
min-height: calc(100vh - 260px);
212+
min-height: 200px;
213213
margin: 0 auto;
214214
display: flex;
215215
justify-content: center;
@@ -220,12 +220,12 @@ class Home extends React.Component {
220220
width: 100%;
221221
}
222222
.about__tag {
223-
font-size: 2.5em;
223+
font-size: 2.5rem;
224224
}
225225
.container {
226226
background-color: #ffffff;
227227
text-align: center;
228-
padding: 60px;
228+
padding: 20px;
229229
}
230230
.taglines {
231231
padding-bottom: 20px;
@@ -252,7 +252,11 @@ class Home extends React.Component {
252252
.discord-subscribe .container {
253253
background: #FAFAFA;
254254
}
255-
255+
@media (max-width: 720px) {
256+
.about__tag {
257+
font-size: 1.5rem;
258+
}
259+
}
256260
`}</style>
257261
</div>
258262
);

pages/learn/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Learn extends React.Component {
4040

4141
render() {
4242
return (
43-
<div className="root">
43+
<div>
4444
<CommonBanner
4545
pageTitle="Learn"
4646
pageSubTitle="Open Source Learning Guides to master your favorite technology"
@@ -135,7 +135,7 @@ class Learn extends React.Component {
135135
align-content: flex-start;
136136
align-items: flex-start;
137137
background-color: #ffffff;
138-
padding: 30px;
138+
padding: 20px;
139139
min-height: calc(100vh - 70px);
140140
margin: 0 auto;
141141
}

pages/space.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,11 @@ export default publicPage(() => (
88
<div>
99
<CommonBanner
1010
pageTitle="Space"
11-
pageSubTitle="Physical spaces for collaboration, peer-learning and self-learning"
11+
pageSubTitle="Physical spaces for collaboration, peer-learning and self-learning. These are dynamic learning environments, where everyone learns at their own pace and
12+
compliments each other. You can also participate in weekly group activities like Open
13+
source evenings and other casual competitions"
1214
/>
1315
<main>
14-
<section>
15-
<div>
16-
<Card centered fluid>
17-
<Card.Content>
18-
These are dynamic learning environments, where everyone learns at
19-
their own pace and compliments each other. You can also
20-
participate in weekly group activities like Open source evenings
21-
and other casual competitions
22-
</Card.Content>
23-
</Card>
24-
</div>
25-
</section>
2616
<section>
2717
<h2>Who is this for?</h2>
2818
<div>

0 commit comments

Comments
 (0)