Skip to content

Commit ded0bf5

Browse files
Fix mobile doc display
1 parent c802e13 commit ded0bf5

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

src/librustdoc/html/render.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -4098,12 +4098,13 @@ impl<'a> fmt::Display for Sidebar<'a> {
40984098
</div>",
40994099
version)?;
41004100
}
4101+
}
41014102

4103+
write!(fmt, "<div class=\"sidebar-elems\">")?;
4104+
if it.is_crate() {
41024105
write!(fmt, "<a id='all-types' href='all.html'><p>See all {}'s items</p></a>",
41034106
it.name.as_ref().expect("crates always have a name"))?;
41044107
}
4105-
4106-
write!(fmt, "<div class=\"sidebar-elems\">")?;
41074108
match it.inner {
41084109
clean::StructItem(ref s) => sidebar_struct(fmt, it, s)?,
41094110
clean::TraitItem(ref t) => sidebar_trait(fmt, it, t)?,

src/librustdoc/html/static/rustdoc.css

+24-13
Original file line numberDiff line numberDiff line change
@@ -909,10 +909,9 @@ span.since {
909909
padding-top: 0px;
910910
}
911911

912-
.sidebar {
912+
body > .sidebar {
913913
height: 45px;
914914
min-height: 40px;
915-
width: calc(100% + 30px);
916915
margin: 0;
917916
margin-left: -15px;
918917
padding: 0 15px;
@@ -1014,6 +1013,10 @@ span.since {
10141013
.anchor {
10151014
display: none !important;
10161015
}
1016+
1017+
h1.fqn {
1018+
overflow: initial;
1019+
}
10171020
}
10181021

10191022
@media print {
@@ -1113,6 +1116,18 @@ h4 > .important-traits {
11131116
top: 2px;
11141117
}
11151118

1119+
#all-types {
1120+
text-align: center;
1121+
border: 1px solid;
1122+
margin: 0 10px;
1123+
margin-bottom: 10px;
1124+
display: block;
1125+
border-radius: 7px;
1126+
}
1127+
#all-types > p {
1128+
margin: 5px 0;
1129+
}
1130+
11161131
@media (max-width: 700px) {
11171132
h4 > .important-traits {
11181133
position: absolute;
@@ -1136,6 +1151,9 @@ h4 > .important-traits {
11361151
background-color: rgba(0,0,0,0);
11371152
height: 100%;
11381153
}
1154+
.sidebar {
1155+
width: calc(100% + 30px);
1156+
}
11391157

11401158
.show-it {
11411159
display: block;
@@ -1181,6 +1199,10 @@ h4 > .important-traits {
11811199
.impl > .collapse-toggle {
11821200
left: -10px;
11831201
}
1202+
1203+
#all-types {
1204+
margin: 10px;
1205+
}
11841206
}
11851207

11861208

@@ -1384,17 +1406,6 @@ kbd {
13841406
#main > ul > li {
13851407
list-style: none;
13861408
}
1387-
#all-types {
1388-
text-align: center;
1389-
border: 1px solid;
1390-
margin: 0 10px;
1391-
margin-bottom: 10px;
1392-
display: block;
1393-
border-radius: 7px;
1394-
}
1395-
#all-types > p {
1396-
margin: 5px 0;
1397-
}
13981409

13991410
.non-exhaustive {
14001411
margin-bottom: 1em;

0 commit comments

Comments
 (0)