Skip to content

Commit b4673a6

Browse files
authored
Merge pull request linode#78 from alioso/mobile-updates
Mobile UX improvement
2 parents 2a49591 + 57b5ca9 commit b4673a6

File tree

4 files changed

+30
-11
lines changed

4 files changed

+30
-11
lines changed

gatsby-browser.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44
* See: https://www.gatsbyjs.org/docs/browser-apis/
55
*/
66

7-
const transitionDelay = 50;
7+
const windowWidth = window.screen.width;
8+
const transitionDelay = windowWidth <= 480 ? 0 : 50;
89

910
exports.shouldUpdateScroll = ({ routerProps: { location } }) => {
1011
if (!location.hash || !document.getElementById(location.hash.substr(1))) {
1112
window.setTimeout(() => window.scrollTo(0, 0), transitionDelay);
1213
} else {
1314
window.setTimeout(
1415
() =>
15-
document
16-
.getElementById(location.hash.substr(1))
17-
.scrollIntoView({ block: "start", behavior: "smooth" }),
16+
document.getElementById(location.hash.substr(1)).scrollIntoView({
17+
block: "start",
18+
behavior: transitionDelay <= 480 ? "auto" : "smooth"
19+
}),
1820
transitionDelay
1921
);
2022
}

src/components/2_molecules/sidemenu.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,19 @@ class SideMenu extends React.Component {
6868
});
6969
});
7070

71+
const windowWidth = window.screen.width;
72+
console.log(windowWidth);
73+
const transitionDelay = windowWidth <= 480 ? 0 : 50;
74+
7175
hash &&
7276
document.getElementById(hash.substr(1)) !== null &&
7377
window.setTimeout(
7478
() =>
75-
document
76-
.getElementById(hash.substr(1))
77-
.scrollIntoView({ block: "start", behavior: "smooth" }),
78-
50
79+
document.getElementById(hash.substr(1)).scrollIntoView({
80+
block: "start",
81+
behavior: windowWidth <= 480 ? "auto" : "smooth"
82+
}),
83+
transitionDelay
7984
);
8085
}
8186

src/components/5_templates/api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class apiPage extends React.Component {
101101
<span className="tag big bold mr-2 uppercase">
102102
{mode}
103103
</span>
104-
<pre className="whitespace-pre-line">
104+
<pre className="whitespace-pre-line break-word">
105105
{m.servers
106106
? m.servers[0].url
107107
: "https://api.linode.com/v4"}

src/css/components/4_pages/api-page.css

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,16 @@
2626

2727
.endpoint-anchor {
2828
position: relative;
29-
top: -84px;
29+
top: -154px;
3030
visibility: hidden;
3131
}
3232

33+
@screen sm {
34+
.endpoint-anchor {
35+
top: -84px;
36+
}
37+
}
38+
3339
.list-group,
3440
.list-group ul {
3541
max-height: 0;
@@ -171,13 +177,19 @@
171177
@apply border-grey-light mb-8;
172178
}
173179

180+
.search-header input {
181+
max-width: 100%;
182+
}
183+
174184
.search-header-wrapper {
175185
position: sticky;
176186
top: 65px;
177187
width: 100%;
178188
z-index: 1;
179-
padding: 1rem 1rem 0;
189+
padding: 1rem;
180190
background-color: #fff;
191+
border-bottom-width: 1px;
192+
@apply border-grey-light;
181193
}
182194

183195
.search-results-list {

0 commit comments

Comments
 (0)