Skip to content

Commit a14c4ab

Browse files
authored
Merge pull request #441 from pastelsky/mobile-enhancements
Mobile enhancements
2 parents 76cca17 + c439c8b commit a14c4ab

File tree

3 files changed

+50
-24
lines changed

3 files changed

+50
-24
lines changed

components/sidebar-mobile/sidebar-mobile-style.scss

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
.sidebar-mobile {
55
position: fixed;
6-
width: 295px;
6+
width: 300px;
77
height: 100vh;
88
z-index: 100;
99
top: 0;
@@ -12,12 +12,12 @@
1212
-webkit-overflow-scrolling: touch;
1313
transform: translate3D(-100%, 0, 0);
1414
transform: translate3D(calc(-100% + 5px), 0, 0);
15-
transition: all 500ms;
15+
transition: all 500ms cubic-bezier(0.23, 1, 0.32, 1);
1616

1717
@include break {
1818
display: none;
1919
}
20-
20+
2121
&--visible {
2222
transform: translate3D(0, 0, 0);
2323
}
@@ -40,50 +40,73 @@
4040
width: 285px;
4141
height: 100vh;
4242
overflow-x: hidden;
43+
padding: 12px 0;
4344
background: getColor(white);
44-
box-shadow: 0 0 5px getColor(emperor);
45+
box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
4546
}
4647

4748
.sidebar-mobile__close {
4849
position:absolute;
49-
right:16px;
50-
top:19px;
51-
font-size:1.5em;
5250
cursor:pointer;
53-
color:getColor(dusty-grey);
54-
transition:color 250ms;
51+
right: 22px;
52+
top: 22px;
53+
font-size: 1.3em;
54+
background: getColor(denim);
55+
color: getColor(white);
56+
width: 30px;
57+
height: 30px;
58+
display: flex;
59+
align-items: center;
60+
justify-content: center;
61+
border-radius: 50%;
62+
transition: background 150ms;
63+
-webkit-tap-highlight-color: transparent;
5564

5665
&:hover {
57-
color:getColor(mine-shaft);
66+
background: darken(getColor(denim), 20%);
5867
}
5968
}
6069

6170
.sidebar-mobile__section {
62-
font-size: getFontSize(1);
63-
text-transform: uppercase;
64-
color: getColor(mine-shaft);
65-
margin: 1em 16px 0.25em;
71+
border-left: 2px solid transparent;
72+
padding-bottom:0.5em;
73+
74+
&--active {
75+
border-left: 2px solid getColor(malibu);
6676

67-
&--block {
68-
display: block;
77+
.sidebar-mobile__section-header {
78+
color: lighten(getColor(fiord), 15%)
79+
}
6980
}
81+
}
7082

71-
&:active,
72-
&--active {
73-
color: getColor(malibu);
83+
.sidebar-mobile__section-header {
84+
text-transform: uppercase;
85+
color: getColor(elephant);
86+
padding: 0.75em 16px 0.25em;
87+
font-weight: 600;
88+
display: block;
89+
90+
.sidebar-mobile__content div:not(:first-of-type) & {
91+
border-top: 1px solid getColor(alto);
7492
}
7593
}
7694

7795
.sidebar-mobile__page {
7896
display: block;
7997
padding: 0.5em 17px;
8098
text-transform: capitalize;
81-
color: getColor(dusty-grey);
99+
color: getColor(dove-grey);
82100
-webkit-tap-highlight-color: rgba(0,0,0,0);
83101

84102
&:active,
85103
&--active {
86104
color: getColor(mine-shaft);
87-
background: getColor(alto);
105+
font-weight: 600;
106+
background: #F1F4F4;
107+
}
108+
109+
&:hover {
110+
color: inherit;
88111
}
89112
}

components/sidebar-mobile/sidebar-mobile.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ export default class SidebarMobile extends React.Component {
6868
let active = pathname === section.url || pathname.includes(`/${section.url}`),
6969
absoluteUrl = `/${section.url}`;
7070
return (
71-
<div key={ absoluteUrl }>
72-
<Link
73-
className={ `sidebar-mobile__section sidebar-mobile__section--block ${active ? 'sidebar-mobile__section--active' : ''}` }
71+
<div
72+
className={ `sidebar-mobile__section ${active ? 'sidebar-mobile__section--active' : ''}` }
73+
key={ absoluteUrl }>
74+
<Link
75+
className="sidebar-mobile__section-header"
7476
key={ absoluteUrl }
7577
to={ absoluteUrl }
7678
onClick={ this._close.bind(this) }>

template.ejs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset="UTF-8">
55
<title><%= webpackConfig.template.title %></title>
66
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<meta name="theme-color" content="#2B3A42">
78
<link rel="shortcut icon" href="/assets/favicon.ico">
89

910
<link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css" />

0 commit comments

Comments
 (0)