Skip to content

Commit 58299ad

Browse files
committed
rustdoc: show logo in source sub nav
1 parent 96bf5cc commit 58299ad

File tree

5 files changed

+87
-41
lines changed

5 files changed

+87
-41
lines changed

src/librustdoc/html/static/css/rustdoc.css

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,27 @@ nav.sub {
306306
text-transform: uppercase;
307307
}
308308

309+
.sub-container {
310+
display: flex;
311+
flex-direction: row;
312+
flex-wrap: nowrap;
313+
}
314+
315+
.sub-logo-container {
316+
display: none;
317+
margin-right: 20px;
318+
}
319+
320+
.source .sub-logo-container {
321+
display: block;
322+
}
323+
324+
.source .sub-logo-container > img {
325+
height: 60px;
326+
width: 60px;
327+
object-fit: contain;
328+
}
329+
309330
.sidebar {
310331
width: 200px;
311332
min-width: 200px;
@@ -728,6 +749,7 @@ nav.sub {
728749
}
729750

730751
nav:not(.sidebar) {
752+
flex-grow: 1;
731753
border-bottom: 1px solid;
732754
padding-bottom: 10px;
733755
margin-bottom: 25px;
@@ -2019,4 +2041,17 @@ details.undocumented[open] > summary::before {
20192041
.docblock {
20202042
margin-left: 12px;
20212043
}
2044+
2045+
.sub-container {
2046+
flex-direction: column;
2047+
}
2048+
2049+
.sub-logo-container {
2050+
align-self: center;
2051+
}
2052+
2053+
.source .sub-logo-container > img {
2054+
height: 35px;
2055+
width: 35px;
2056+
}
20222057
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pre, .rustdoc.source .example-wrap {
6161
background-color: #14191f;
6262
}
6363

64-
.logo-container.rust-logo > img {
64+
.rust-logo > img {
6565
filter: drop-shadow(1px 0 0px #fff)
6666
drop-shadow(0 1px 0 #fff)
6767
drop-shadow(-1px 0 0 #fff)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pre, .rustdoc.source .example-wrap {
3232
background-color: #505050;
3333
}
3434

35-
.logo-container.rust-logo > img {
35+
.rust-logo > img {
3636
filter: drop-shadow(1px 0 0px #fff)
3737
drop-shadow(0 1px 0 #fff)
3838
drop-shadow(-1px 0 0 #fff)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pre, .rustdoc.source .example-wrap {
4343
scrollbar-color: rgba(36, 37, 39, 0.6) #d9d9d9;
4444
}
4545

46-
.logo-container.rust-logo > img {
46+
.rust-logo > img {
4747
/* No need for a border in here! */
4848
}
4949

src/librustdoc/html/templates/page.html

Lines changed: 49 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -56,51 +56,62 @@
5656
<div class="sidebar-menu" role="button">&#9776;</div> {#- -#}
5757
<a class="sidebar-logo" href='{{page.root_path | safe}}{{krate_with_trailing_slash | safe}}index.html'> {#- -#}
5858
<div class='logo-container rust-logo'> {#- -#}
59-
<img src='
60-
{%- if layout.logo -%}
61-
{{layout.logo}}
62-
{%- else -%}
63-
{{static_root_path | safe}}rust-logo{{page.resource_suffix}}.png
64-
{%- endif -%}
65-
' alt='logo'> {#- -#}
59+
<img src='
60+
{%- if layout.logo -%}
61+
{{layout.logo}}
62+
{%- else -%}
63+
{{static_root_path | safe}}rust-logo{{page.resource_suffix}}.png
64+
{%- endif -%}
65+
' alt='logo'> {#- -#}
6666
</div> {#- -#}
6767
</a> {#- -#}
6868
{{- sidebar | safe -}}
6969
</nav> {#- -#}
7070
<main> {#- -#}
7171
<div class="main-inner"> {#- -#}
72-
<nav class="sub"> {#- -#}
73-
<div class="theme-picker"> {#- -#}
74-
<button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"> {#- -#}
75-
<img width="18" height="18" alt="Pick another theme!" {# -#}
76-
src="{{static_root_path | safe}}brush{{page.resource_suffix}}.svg"> {#- -#}
77-
</button> {#- -#}
78-
<div id="theme-choices" role="menu"></div> {#- -#}
79-
</div> {#- -#}
80-
<form class="search-form"> {#- -#}
81-
<div class="search-container"> {#- -#}
82-
<div>{%- if layout.generate_search_filter -%}
83-
<select id="crate-search"> {#- -#}
84-
<option value="All crates">All crates</option> {#- -#}
85-
</select> {#- -#}
86-
{%- endif -%}
87-
<input {# -#}
88-
class="search-input" {# -#}
89-
name="search" {# -#}
90-
disabled {# -#}
91-
autocomplete="off" {# -#}
92-
spellcheck="false" {# -#}
93-
placeholder="Click or press ‘S’ to search, ‘?’ for more options…" {# -#}
94-
type="search"> {#- -#}
95-
</div> {#- -#}
96-
<button type="button" id="help-button" title="help">?</button> {#- -#}
97-
<a id="settings-menu" href="{{page.root_path | safe}}settings.html" title="settings"> {#- -#}
98-
<img width="18" height="18" alt="Change settings" {# -#}
99-
src="{{static_root_path | safe}}wheel{{page.resource_suffix}}.svg"> {#- -#}
100-
</a> {#- -#}
72+
<div class="sub-container"> {#- -#}
73+
<a class="sub-logo-container rust-logo" href='{{page.root_path | safe}}{{krate_with_trailing_slash | safe}}index.html'> {#- -#}
74+
<img src='
75+
{%- if layout.logo -%}
76+
{{layout.logo}}
77+
{%- else -%}
78+
{{static_root_path | safe}}rust-logo{{page.resource_suffix}}.png
79+
{%- endif -%}
80+
' alt='logo'> {#- -#}
81+
</a> {#- -#}
82+
<nav class="sub"> {#- -#}
83+
<div class="theme-picker"> {#- -#}
84+
<button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"> {#- -#}
85+
<img width="18" height="18" alt="Pick another theme!" {# -#}
86+
src="{{static_root_path | safe}}brush{{page.resource_suffix}}.svg"> {#- -#}
87+
</button> {#- -#}
88+
<div id="theme-choices" role="menu"></div> {#- -#}
10189
</div> {#- -#}
102-
</form> {#- -#}
103-
</nav> {#- -#}
90+
<form class="search-form"> {#- -#}
91+
<div class="search-container"> {#- -#}
92+
<div>{%- if layout.generate_search_filter -%}
93+
<select id="crate-search"> {#- -#}
94+
<option value="All crates">All crates</option> {#- -#}
95+
</select> {#- -#}
96+
{%- endif -%}
97+
<input {# -#}
98+
class="search-input" {# -#}
99+
name="search" {# -#}
100+
disabled {# -#}
101+
autocomplete="off" {# -#}
102+
spellcheck="false" {# -#}
103+
placeholder="Click or press ‘S’ to search, ‘?’ for more options…" {# -#}
104+
type="search"> {#- -#}
105+
</div> {#- -#}
106+
<button type="button" id="help-button" title="help">?</button> {#- -#}
107+
<a id="settings-menu" href="{{page.root_path | safe}}settings.html" title="settings"> {#- -#}
108+
<img width="18" height="18" alt="Change settings" {# -#}
109+
src="{{static_root_path | safe}}wheel{{page.resource_suffix}}.svg"> {#- -#}
110+
</a> {#- -#}
111+
</div> {#- -#}
112+
</form> {#- -#}
113+
</nav> {#- -#}
114+
</div> {#- -#}
104115
<section id="main" class="content">{{- content | safe -}}</section> {#- -#}
105116
<section id="search" class="content hidden"></section> {#- -#}
106117
</div> {#- -#}

0 commit comments

Comments
 (0)