Skip to content

Commit 501f769

Browse files
authored
Fix table scroll on mobile (#26)
* Add bare minimum styles for mobile devices tables This is to address #10 * Remove changes for code blocks * Make tables scrollable This includes changes for styles, that lead to artifacts. * Added points from code review
1 parent 2822e9b commit 501f769

File tree

3 files changed

+54
-24
lines changed

3 files changed

+54
-24
lines changed

_sass/variables.scss

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// This needs to be an odd number, to prevent some slightly thicker line on
2+
// horizontal scroll (https://github.com/gbdev/rgbds-www/pull/26#issuecomment-989158940)
3+
$navbar-height: 51px;
4+
$navbar-border-bottom: 1px;
5+
$navbar-box-height: $navbar-height + $navbar-border-bottom;
6+
$navbar-breakpoint: 720px; // Width at which the navbar collapses
7+
$navbar-bg-color: #e2e8cb;
8+
9+
$logo-padding-top: 10px;
10+
$logo-padding-bottom: 10px;
11+
$logo-padding-left: 20px;
12+
$logo-padding-right: 0px;
13+
14+
$nav-link-padding-top: 7px;
15+
$nav-link-padding-bottom: 14px;
16+
$nav-link-padding-left: 10px;
17+
$nav-link-padding-right: 10px;
18+
$nav-logo-padding-top: 5px;
19+
$nav-logo-padding-bottom: 5px;
20+
21+
$max-width: 50em;
22+
23+
/// media-queries
24+
$mobile-device: 480px;
25+
26+
/// colors
27+
$main-background: #eee;

css/default.scss

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,7 @@
22
---
33

44
@import "monokai";
5-
6-
/// Variable definitions
7-
8-
$navbar-height: 50px;
9-
$navbar-border-bottom: 1px;
10-
$navbar-box-height: $navbar-height + $navbar-border-bottom;
11-
$navbar-breakpoint: 720px; // Width at which the navbar collapses
12-
$navbar-bg-color: #e2e8cb;
13-
14-
$logo-padding-top: 10px;
15-
$logo-padding-bottom: 10px;
16-
$logo-padding-left: 20px;
17-
$logo-padding-right: 0px;
18-
19-
$nav-link-padding-top: 7px;
20-
$nav-link-padding-bottom: 14px;
21-
$nav-link-padding-left: 10px;
22-
$nav-link-padding-right: 10px;
23-
$nav-logo-padding-top: 5px;
24-
$nav-logo-padding-bottom: 5px;
25-
26-
$max-width: 50em;
5+
@import "variables";
276

287
/// General styling
298

@@ -43,6 +22,11 @@ body {
4322

4423
margin: 0;
4524
width: 100%;
25+
26+
@media screen and (max-width: $mobile-device) {
27+
// prevent background image leak
28+
background: $main-background;
29+
}
4630
}
4731

4832
code, pre {
@@ -88,7 +72,6 @@ body {
8872

8973
background-color: $navbar-bg-color;
9074
border-bottom: 1px solid #ccc;
91-
box-shadow: 0 0 20px rgba(204,204,204,0.5);
9275
}
9376

9477
#logo {
@@ -201,5 +184,5 @@ main {
201184
max-width: $max-width;
202185
// Prevent text from bumping sides on smaller windows
203186
padding: 10px 20px;
204-
background: #eee;
187+
background: $main-background;
205188
}

css/doc.scss

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ layout: null
33
permalink: /css/doc.css
44
---
55

6+
@import "variables";
7+
68
#man {
79
// Disable justification (see https://github.com/gbdev/rgbds-www/issues/13)
810
text-align: left;
@@ -32,3 +34,21 @@ permalink: /css/doc.css
3234
padding: 2px 7px 0;
3335
}
3436
}
37+
38+
@media screen and (max-width: $mobile-device) {
39+
#man {
40+
table.Bl-column {
41+
// This is to utilize all available space better on mobile
42+
margin-left: 0;
43+
table-layout: fixed;
44+
max-width: 200vw;
45+
46+
td, th {
47+
// break basically everything if space is small
48+
overflow-wrap: break-word;
49+
// Force min-width in conjunction with word-break setting
50+
min-width: 15vw;
51+
}
52+
}
53+
}
54+
}

0 commit comments

Comments
 (0)