Skip to content

Commit 185f258

Browse files
authored
Rollup merge of rust-lang#47810 - GuillaumeGomez:fix-theme-but-position, r=QuietMisdreavus
Fix rendering issues on mobile Fixes rust-lang#47723 r? @QuietMisdreavus
2 parents d920f1f + 8a587e6 commit 185f258

File tree

3 files changed

+55
-4
lines changed

3 files changed

+55
-4
lines changed

src/librustdoc/html/static/main.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
// 2 for "In Return Types"
4848
var currentTab = 0;
4949

50+
var themesWidth = null;
51+
5052
function hasClass(elem, className) {
5153
if (elem && className && elem.className) {
5254
var elemClass = elem.className;
@@ -121,10 +123,25 @@
121123
sidebar.appendChild(div);
122124
}
123125
}
126+
var themeChoices = document.getElementById("theme-choices");
127+
if (themeChoices) {
128+
if (!themesWidth) {
129+
var savedState = themeChoices.style.display;
130+
themeChoices.style.display = 'block';
131+
themesWidth = themeChoices.offsetWidth + 'px';
132+
themeChoices.style.display = savedState;
133+
}
134+
themeChoices.style.position = "fixed";
135+
themeChoices.style.width = themesWidth;
136+
themeChoices.style.top = '78px';
137+
themeChoices.style.left = '250px';
138+
}
124139
document.getElementsByTagName("body")[0].style.marginTop = '45px';
125140
var themePicker = document.getElementById("theme-picker");
126141
if (themePicker) {
127142
themePicker.style.position = "fixed";
143+
themePicker.style.top = "50px";
144+
themePicker.style.left = "250px";
128145
}
129146
}
130147

@@ -143,6 +160,15 @@
143160
var themePicker = document.getElementById("theme-picker");
144161
if (themePicker) {
145162
themePicker.style.position = "absolute";
163+
themePicker.style.top = null;
164+
themePicker.style.left = null;
165+
}
166+
var themeChoices = document.getElementById("theme-choices");
167+
if (themeChoices) {
168+
themeChoices.style.position = 'absolute';
169+
themeChoices.style.width = null;
170+
themeChoices.style.top = null;
171+
themeChoices.style.left = null;
146172
}
147173
}
148174

src/librustdoc/html/static/rustdoc.css

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,7 @@ span.since {
870870
display: block;
871871
border-bottom: 1px solid;
872872
border-right: 1px solid;
873+
height: 45px;
873874
}
874875

875876
.sidebar-elems {
@@ -889,13 +890,19 @@ span.since {
889890
}
890891

891892
nav.sub {
892-
margin: 0 auto;
893+
width: calc(100% - 32px);
894+
float: right;
893895
}
894896

895897
.content {
896898
margin-left: 0px;
897899
}
898900

901+
#main {
902+
margin-top: 50px;
903+
padding: 0;
904+
}
905+
899906
.content .in-band {
900907
width: 100%;
901908
}
@@ -1042,6 +1049,24 @@ h4 > .important-traits {
10421049

10431050
.show-it {
10441051
display: block;
1052+
width: 246px;
1053+
}
1054+
1055+
.show-it > .block.items {
1056+
margin: 8px 0;
1057+
}
1058+
1059+
.show-it > .block.items > ul {
1060+
margin: 0;
1061+
}
1062+
1063+
.show-it > .block.items > ul > li {
1064+
text-align: center;
1065+
margin: 2px 0;
1066+
}
1067+
1068+
.show-it > .block.items > ul > li > a {
1069+
font-size: 21px;
10451070
}
10461071

10471072
/* Because of ios, we need to actually have a full height sidebar title so the
@@ -1198,8 +1223,8 @@ kbd {
11981223

11991224
@media (max-width: 700px) {
12001225
.theme-picker {
1201-
left: 109px;
1202-
top: 7px;
1226+
left: 10px;
1227+
top: 54px;
12031228
z-index: 1;
12041229
}
12051230
}

src/librustdoc/html/static/themes/dark.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,6 @@ kbd {
383383

384384
@media (max-width: 700px) {
385385
#theme-picker {
386-
background: #353535;
386+
background: #f0f0f0;
387387
}
388388
}

0 commit comments

Comments
 (0)