Skip to content

Commit e73eff7

Browse files
authored
Use more horizontal space on smaller screens (#1643)
1 parent 5889488 commit e73eff7

File tree

11 files changed

+142
-23
lines changed

11 files changed

+142
-23
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ For example, here are some acceptable values:
115115
ExDoc uses [the makeup project](https://github.com/elixir-makeup/makeup) for syntax highlighting. By default, highlighters for Erlang and Elixir are included. To syntax-highlight other languages, simply add the equivalent `makeup_LANGUAGE` package to your `mix.exs`/`rebar.config` file. For example, for HTML support you would add:
116116

117117
```elixir
118-
{:makeup_html, ">= 0.0.0", only: :dev, runtime: false}
118+
{:makeup_html, ">= 0.0.0", only: :dev, runtime: false}
119119
```
120120

121121
You can find all supported languages under [the Makeup organization on GitHub](https://github.com/elixir-makeup) and view them at [Makeup's website](https://elixir-makeup.github.io/makeup_demo/).

assets/css/content/admonition.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,17 @@
9696
border: 1px solid var(--inlineCodeBorder);
9797
color: var(--black);
9898
}
99+
100+
@media screen and (max-width: 768px) {
101+
.content-inner blockquote:is(.warning, .error, .info, .neutral, .tip) {
102+
margin-left: calc(-1 * var(--content-gutter));
103+
margin-right: calc(-1 * var(--content-gutter));
104+
padding-left: var(--content-gutter);
105+
padding-right: var(--content-gutter);
106+
border-radius: 0;
107+
}
108+
109+
.content-inner blockquote :is(h3, h4):is(.warning, .error, .info, .neutral, .tip) {
110+
margin: 0 calc(-1 * var(--content-gutter));
111+
}
112+
}

assets/css/content/cheatsheet.css

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
.page-cheatmd h2 {
2727
margin: var(--vertical-space) 0;
2828
column-span: all;
29-
padding-left: 3px;
3029
color: var(--gray700);
3130
font-weight: 500;
3231
}
@@ -38,13 +37,15 @@
3837
/* h3 */
3938

4039
.page-cheatmd h3 {
41-
overflow: hidden;
4240
margin: 0 0 1em;
43-
padding-left: 5px;
4441
color: var(--main);
4542
font-weight: 400;
4643
}
4744

45+
.page-cheatmd h3.section-heading .hover-link {
46+
display: none;
47+
}
48+
4849
.page-cheatmd section.h3 {
4950
min-width: 300px;
5051
margin: 0 0 calc(var(--vertical-space) * 2) 0;
@@ -224,7 +225,6 @@
224225
}
225226

226227
.page-cheatmd section.col-2-left > h2 {
227-
display: block;
228228
grid-column-end: span 2;
229229
}
230230

@@ -295,5 +295,9 @@
295295
.page-cheatmd section.list-6 > ul > li {
296296
flex: 0 0 50%;
297297
}
298+
299+
.page-cheatmd section.width-50 {
300+
width: 100%;
301+
}
298302
}
299303
}

assets/css/content/code.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,27 @@
7474
border-bottom: 0;
7575
border-radius: 2px;
7676
}
77+
78+
@media screen and (max-width: 768px) {
79+
/*
80+
TODO:
81+
82+
This selector can be more specific once Firefox ships default
83+
support for the :has() pseudo-class: https://caniuse.com/css-has
84+
85+
.content-inner > pre:has(code),
86+
.content-inner section > pre:has(code) {
87+
*/
88+
.content-inner > pre,
89+
.content-inner section > pre {
90+
margin-left: calc(-1 * var(--content-gutter) - 2px);
91+
margin-right: calc(-1 * var(--content-gutter) - 2px);
92+
}
93+
94+
.content-inner > pre code,
95+
.content-inner section > pre code {
96+
padding-left: var(--content-gutter);
97+
padding-right: var(--content-gutter);
98+
border-radius: 0;
99+
}
100+
}

assets/css/content/functions.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@
5454
border: none;
5555
}
5656

57+
@media screen and (max-width: 768px) {
58+
.content-inner .detail-header a.detail-link {
59+
margin-left: -30px;
60+
}
61+
}
62+
5763
.content-inner .specs pre {
5864
font-family: var(--monoFontFamily);
5965
font-size: .9em;
@@ -72,6 +78,12 @@
7278
margin: 1.2em 0 3em 1.2em;
7379
}
7480

81+
@media screen and (max-width: 768px) {
82+
.content-inner .docstring {
83+
margin-left: 0;
84+
}
85+
}
86+
7587
.content-inner .docstring:is(h2, h3, h4, h5) {
7688
font-weight: 700;
7789
}

assets/css/content/general.css

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@
135135
vertical-align: top;
136136
}
137137

138+
.content-inner .section-heading {
139+
position: relative;
140+
}
141+
138142
.content-inner .section-heading:hover a.hover-link {
139143
opacity: 1;
140144
text-decoration: none;
@@ -146,15 +150,20 @@
146150
opacity: 0;
147151
padding: .3em .6em .6em;
148152
line-height: 1em;
149-
margin-left: -2.7em;
153+
margin-left: -2.4em;
150154
text-decoration: none;
151155
border: none;
152156
font-size: 16px;
153157
vertical-align: middle;
154158
}
155159

156-
.content-inner .detail :is(h1, h2, h3, h4, h5, h6).section-heading {
157-
margin-left: .3em;
160+
@media screen and (max-width: 768px) {
161+
.content-inner .section-heading a.hover-link {
162+
position: absolute;
163+
bottom: 0;
164+
right: -20px;
165+
padding: .3em .6em .4em;
166+
}
158167
}
159168

160169
.content-inner .app-vsn {
@@ -179,3 +188,9 @@
179188
line-height: 24px;
180189
font-weight: 400;
181190
}
191+
192+
@media screen and (max-width: 768px) {
193+
.content-inner :is(ol, ul) {
194+
padding-left: calc(1.5 * var(--content-gutter));
195+
}
196+
}

assets/css/custom-props/common.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
:root {
2+
/* Layout & Whitespace */
3+
--content-width: 949px;
4+
--content-gutter: 60px;
5+
26
/* Font Families */
37
--serifFontFamily: 'Merriweather', 'Book Antiqua', Georgia, 'Century Schoolbook', serif;
48
--sansFontFamily: 'Lato', sans-serif;
@@ -20,6 +24,8 @@
2024
--gray800: hsl(216, 52%, 11% );
2125
--gray800-opacity-0: hsla(216, 52%, 11%, 0%);
2226
--gray900: hsl(218, 73%, 4% );
27+
--gray900-opacity-50: hsla(218, 73%, 4%, 50%);
28+
--gray900-opacity-0: hsla(218, 73%, 4%, 0%);
2329
--coldGrayFaint: hsl(240, 5%, 97% );
2430
--coldGrayLight: hsl(240, 5%, 88% );
2531
--coldGray-lightened-10: hsl(240, 5%, 56% );
@@ -32,8 +38,17 @@
3238
--green-lightened-10: hsl( 90, 100%, 45% );
3339
--green: hsl( 90, 100%, 35% );
3440
--white: hsl( 0, 0%, 100% );
41+
--white-opacity-50: hsla( 0, 0%, 100%, 50%);
3542
--white-opacity-10: hsla( 0, 0%, 100%, 10%);
43+
--white-opacity-0: hsla( 0, 0%, 100%, 0%);
3644
--black: hsl( 0, 0%, 0% );
3745
--black-opacity-10: hsla( 0, 0%, 0%, 10%);
3846
--black-opacity-50: hsla( 0, 0%, 0%, 50%);
3947
}
48+
49+
@media screen and (max-width: 768px) {
50+
:root {
51+
--content-width: 100%;
52+
--content-gutter: 20px;
53+
}
54+
}

assets/css/custom-props/theme-dark.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,5 @@ body.dark {
6060
--success: var(--green-lightened-10);
6161

6262
--sidebarButton: var(--gray50);
63+
--sidebarButtonBackground: linear-gradient(180deg, var(--gray900) 20%, var(--gray900-opacity-50) 70%, var(--gray900-opacity-0) 100%);
6364
}

assets/css/custom-props/theme-light.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,5 @@
6060
--success: var(--green);
6161

6262
--sidebarButton: var(--gray100);
63+
--sidebarButtonBackground: linear-gradient(180deg, var(--white) 20%, var(--white-opacity-50) 70%, var(--white-opacity-0) 100%);
6364
}

assets/css/layout.css

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ body {
3737
}
3838

3939
.sidebar-button {
40+
--sidebarButtonTopOpen: 6px;
4041
position: fixed;
4142
z-index: 99;
4243
left: 0;
43-
top: 7px;
44-
transition: color .3s ease-in-out, transform .15s ease-out .1s, opacity .15s ease-out .1s;
44+
top: 0;
45+
transition: all .3s ease-in-out;
4546
will-change: transform;
46-
transform: translateX(250px);
4747
}
4848

4949
.content {
@@ -54,8 +54,16 @@ body {
5454
z-index: 3;
5555
}
5656

57-
body.sidebar-opening .sidebar-button {
58-
transition: transform .3s ease-in-out;
57+
@media screen and (max-width: 768px) {
58+
.content {
59+
overflow: auto;
60+
scroll-padding-top: 45px;
61+
}
62+
}
63+
64+
body:is(.sidebar-opening, .sidebar-opened) .sidebar-button {
65+
transform: translateX(250px);
66+
top: var(--sidebarButtonTopOpen);
5967
}
6068

6169
body.sidebar-opening .sidebar {
@@ -84,11 +92,6 @@ body.sidebar-closing .content {
8492
transition: all .3s ease-in-out;
8593
}
8694

87-
body.sidebar-closed .sidebar-button {
88-
transition: transform .3s ease-in-out;
89-
transform: translateY(-8px);
90-
}
91-
9295
body.sidebar-closed .sidebar {
9396
left: -300px;
9497
}
@@ -98,6 +101,35 @@ body.sidebar-closed .content {
98101
left: 0;
99102
}
100103

104+
@media screen and (max-width: 768px) {
105+
.sidebar-button:before {
106+
--sidebarButtonHeight: 60px;
107+
content: '';
108+
display: block;
109+
z-index: -1;
110+
pointer-events: none;
111+
position: fixed;
112+
left: -1px;
113+
top: 0;
114+
height: var(--sidebarButtonHeight);
115+
width: calc(100vw + 2px);
116+
background: var(--sidebarButtonBackground);
117+
transition: top .3s ease-in-out;
118+
}
119+
120+
body:is(.sidebar-closed, .sidebar-closing) .sidebar-button:before {
121+
top: 0;
122+
}
123+
124+
body:is(.sidebar-opening, .sidebar-opened) .sidebar-button:before {
125+
top: calc(-1 * var(--sidebarButtonHeight) - var(--sidebarButtonTopOpen));
126+
}
127+
128+
body.sidebar-opened .sidebar-button:before {
129+
opacity: 0;
130+
}
131+
}
132+
101133
body.search-focused .sidebar-button {
102134
transform: translateX(250px) scaleY(0);
103135
transition: all .15s ease-out;
@@ -110,9 +142,9 @@ body.search-focused .sidebar-search .search-close-button {
110142
}
111143

112144
.content-inner {
113-
max-width: 949px;
145+
max-width: var(--content-width);
114146
margin: 0 auto;
115-
padding: 3px 60px;
147+
padding: 3px var(--content-gutter);
116148
}
117149

118150
.content-inner:focus {
@@ -131,8 +163,8 @@ body.search-focused .sidebar-search .search-close-button {
131163
}
132164

133165
.content-inner {
134-
padding: 27px 20px 27px 40px;
135-
max-width: 100%;
166+
padding-top: 10px;
167+
padding-bottom: 27px;
136168
overflow-x: auto;
137169
}
138170
}

assets/css/sidebar.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,11 @@
406406
}
407407

408408
.sidebar-button {
409+
--sidebar-button-x-padding: 11px;
409410
cursor: pointer;
410411
background-color: transparent;
411412
border: none;
412-
padding: 15px 11px;
413+
padding: 15px var(--sidebar-button-x-padding);
413414
font-size: 16px;
414415
}
415416

0 commit comments

Comments
 (0)