Skip to content

Commit 2318535

Browse files
Merge pull request #1367 from GuillaumeGomez/footer
Add footer
2 parents 803cebf + ac4f87a commit 2318535

14 files changed

+94
-25
lines changed

templates/base.html

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
{%- block header %}{% endblock header -%}
3030

3131
{%- block body -%}{%- endblock body -%}
32+
{%- include "footer.html" -%}
3233

3334
<script type="text/javascript" nonce="{{ csp_nonce }}" src="/-/static/menu.js?{{ docsrs_version() | slugify }}"></script>
3435
<script type="text/javascript" nonce="{{ csp_nonce }}" src="/-/static/index.js?{{ docsrs_version() | slugify }}"></script>

templates/core/about/badges.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{%- block body -%}
66
<h1>Badges</h1>
77

8-
<div>
8+
<div class="about-page">
99
<div class="container pure-u-5-6 about">
1010
<p>
1111
You can use badges to show state of your documentation to your users.

templates/core/about/builds.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{%- block body -%}
66
{%- set docsrs_repo = "https://github.com/rust-lang/docs.rs" -%}
77
<h1>Builds</h1>
8-
<div>
8+
<div class="about-page">
99
<div class="container pure-u-5-6 about">
1010
<p>
1111
Docs.rs automatically builds documentation for crates released on <a href="https://crates.io/">crates.io</a>.

templates/core/about/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{%- set docsrs_repo = "https://github.com/rust-lang/docs.rs" -%}
77

88
<h1 id="crate-title">About Docs.rs</h1>
9-
<div>
9+
<div class="about-page">
1010
<div class="container pure-u-5-6 about">
1111
<p>
1212
Docs.rs is an

templates/core/about/metadata.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{%- block body -%}
66
<h1>Metadata for custom builds</h1>
77

8-
<div>
8+
<div class="about-page">
99
<div class="container pure-u-5-6 about">
1010
<p>
1111
You can customize docs.rs builds by defining <code>[package.metadata.docs.rs]</code>

templates/core/about/redirections.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{%- block body -%}
66
<h1>Shorthand URLs</h1>
77

8-
<div>
8+
<div class="about-page">
99
<div class="container pure-u-5-6 about">
1010
<p>
1111
Docs.rs uses semver to parse URLs. You can use this feature to access

templates/footer.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<div class="docs-rs-footer">
2+
<a href="/about">About docs.rs</a>
3+
<a href="https://foundation.rust-lang.org/policies/privacy-policy/#docs.rs">Privacy policy</a>
4+
<a href="/releases/queue">Build queue</a>
5+
</div>

templates/header/topbar_begin.html

-14
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,6 @@
3434

3535
#}<ul class="pure-menu-list pure-menu-right">
3636
<li class="pure-menu-item pure-menu-has-children pure-menu-allow-hover pure-menu-opt-children">
37-
<a href="/about" class="pure-menu-link">
38-
<span title="About">{{ "info-circle" | fas }}</span>
39-
<span class="title">About</span>
40-
</a>
41-
42-
<ul class="pure-menu-children">
43-
{{ macros::menu_link(href="/about/badges", text="Badges") }}
44-
{{ macros::menu_link(href="/about/builds", text="Builds") }}
45-
{{ macros::menu_link(href="/about/metadata", text="Metadata") }}
46-
{{ macros::menu_link(href="/about/redirections", text="Shorthand URLs") }}
47-
</ul>
48-
</li>{#
49-
50-
#}<li class="pure-menu-item pure-menu-has-children pure-menu-allow-hover pure-menu-opt-children">
5137
<a href="/releases" class="pure-menu-link">
5238
<span title="Releases">{{ "leaf" | fas }}</span>
5339
<span class="title">Releases</span>

templates/rustdoc/body.html

+1
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@
3333

3434
{# see comment in ../../static/storage-change-detection.html for details #}
3535
<iframe src="/-/static/storage-change-detection.html" width="0" height="0" style="display: none"></iframe>
36+
{%- include "footer.html" -%}

templates/style/_navbar.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ div.nav-container {
139139
// These hardcoded values are "magic", in the sense they were observed to be the lowest-possible
140140
// thresholds through experimentation with a package name that hit the max-width of the element.
141141
$full-width: 1142px;
142-
$medium-width: 994px;
143-
$narrow-width: 901px;
142+
$medium-width: 837px;
143+
$narrow-width: 783px;
144144

145145
// use a .title span inside a menu to hide it on small screens
146146
span.title {

templates/style/_vars.scss

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ $font-family-mono: "Source Code Pro", Menlo, Monaco, Consolas, "DejaVu Sans Mono
77

88
// Sizes
99
$top-navbar-height: 32px; // height of the floating top navbar
10+
$footer-height: 30px; // height of the floating footer
1011

1112
// Pure compatible media queries
1213
// usage:

templates/style/base.scss

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// FIXME: Use modules
2-
@import "vars", "utils", "navbar", "themes", "fa";
2+
@import "vars", "utils", "navbar", "themes", "fa", "footer";
33

44
/* See FiraSans-LICENSE.txt for the Fira Sans license. */
55
@font-face {
@@ -74,6 +74,8 @@ textarea,
7474
body {
7575
padding: 0;
7676
margin: 0;
77+
position: relative;
78+
min-height: calc(100vh - #{$top-navbar-height});
7779

7880
* {
7981
-webkit-box-sizing: border-box;
@@ -168,6 +170,10 @@ body {
168170
g.highcharts-grid > path {
169171
stroke: var(--chart-grid) !important;
170172
}
173+
174+
> .about-page {
175+
padding-bottom: calc(#{$footer-height} + 2px);
176+
}
171177
}
172178

173179
pre {
@@ -180,6 +186,11 @@ div.container {
180186
max-width: 1160px;
181187
margin: 0 auto;
182188
text-align: left;
189+
190+
> .chartjs-render-monitor {
191+
// This is to prevent the canvas text to go under the footer.
192+
padding-bottom: 35px;
193+
}
183194
}
184195

185196
div.landing {
@@ -211,7 +222,7 @@ div.landing {
211222

212223
div.recent-releases-container {
213224
text-align: left;
214-
margin-bottom: 50px;
225+
padding-bottom: 50px;
215226

216227
ul,
217228
li {
@@ -396,9 +407,10 @@ div.package-sheet-container {
396407
}
397408

398409
div.package-page-container {
410+
padding-bottom: 50px;
411+
399412
div.package-menu {
400413
padding: 0 10px;
401-
margin-bottom: 50px;
402414

403415
li.pure-menu-heading {
404416
font-size: 1.3em;

templates/style/footer.scss

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@import "vars";
2+
3+
.docs-rs-footer {
4+
position: absolute;
5+
bottom: 0;
6+
right: 0;
7+
width: 100%;
8+
text-align: center;
9+
font-size: 0.9em;
10+
height: $footer-height;
11+
background: var(--color-background);
12+
border-top: 1px solid var(--color-border);
13+
font-family: $font-family-sans;
14+
15+
> a {
16+
font-weight: 400;
17+
border-right: 1px solid var(--color-border);
18+
padding: 4px 8px;
19+
height: 100%;
20+
display: inline-block;
21+
color: var(--color-navbar-standard);
22+
23+
&:hover {
24+
color: var(--color-standard);
25+
}
26+
&:first-child {
27+
border-left: 1px solid var(--color-border);
28+
}
29+
}
30+
}

templates/style/rustdoc.scss

+34-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
// FIXME: Use modules
2-
@import "vars", "navbar", "themes", "fa";
2+
@import "vars", "navbar", "themes", "fa", "footer";
3+
4+
// This rule is needed to be sure that the footer will always be at the bottom of the page.
5+
body.rustdoc-page {
6+
min-height: 100vh;
7+
}
38

49
// Force the navbar to be left-aligned on rustdoc pages
510
body.rustdoc-page > .nav-container > .container {
@@ -8,6 +13,34 @@ body.rustdoc-page > .nav-container > .container {
813

914
div.container-rustdoc {
1015
text-align: left;
16+
17+
> .docs-rs-footer {
18+
bottom: -20px;
19+
}
20+
}
21+
22+
div.container-rustdoc:not(.source) {
23+
> .docs-rs-footer {
24+
right: -15px;
25+
width: calc(100vw - 212px);
26+
}
27+
28+
// This is when the rustdoc sidebar "disappears" (for mobile mode).
29+
@media (max-width: 700px) {
30+
> .docs-rs-footer:not(.source) {
31+
width: 100vw;
32+
}
33+
}
34+
}
35+
36+
div.container-rustdoc.source {
37+
> .docs-rs-footer {
38+
width: 100vw;
39+
left: -15px;
40+
// This is needed because even though the sidebar only contains the header, it still takes
41+
// all the height.
42+
z-index: 1;
43+
}
1144
}
1245

1346
// this is a super nasty override for help dialog in rustdocs

0 commit comments

Comments
 (0)