Skip to content

Commit 6e9954d

Browse files
cynecxGuillaumeGomez
authored andcommitted
rustdoc: show logo in source sub nav
1 parent dc2c972 commit 6e9954d

File tree

5 files changed

+87
-40
lines changed

5 files changed

+87
-40
lines changed

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

+35
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,27 @@ nav.sub {
321321
text-transform: uppercase;
322322
}
323323

324+
.sub-container {
325+
display: flex;
326+
flex-direction: row;
327+
flex-wrap: nowrap;
328+
}
329+
330+
.sub-logo-container {
331+
display: none;
332+
margin-right: 20px;
333+
}
334+
335+
.source .sub-logo-container {
336+
display: block;
337+
}
338+
339+
.source .sub-logo-container > img {
340+
height: 60px;
341+
width: 60px;
342+
object-fit: contain;
343+
}
344+
324345
.sidebar {
325346
width: 200px;
326347
overflow-y: scroll;
@@ -742,6 +763,7 @@ nav.sub {
742763
}
743764

744765
nav:not(.sidebar) {
766+
flex-grow: 1;
745767
border-bottom: 1px solid;
746768
padding-bottom: 10px;
747769
margin-bottom: 25px;
@@ -2017,6 +2039,19 @@ details.rustdoc-toggle[open] > summary.hideme::after {
20172039
.docblock code {
20182040
overflow-wrap: anywhere;
20192041
}
2042+
2043+
.sub-container {
2044+
flex-direction: column;
2045+
}
2046+
2047+
.sub-logo-container {
2048+
align-self: center;
2049+
}
2050+
2051+
.source .sub-logo-container > img {
2052+
height: 35px;
2053+
width: 35px;
2054+
}
20202055
}
20212056

20222057

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

+1-1
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

+1-1
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

+1-1
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

+49-37
Original file line numberDiff line numberDiff line change
@@ -70,50 +70,62 @@
7070
<div class="sidebar-menu" role="button">&#9776;</div> {#- -#}
7171
<a class="sidebar-logo" href='{{page.root_path | safe}}{{krate_with_trailing_slash | safe}}index.html'> {#- -#}
7272
<div class='logo-container rust-logo'> {#- -#}
73-
<img src='
74-
{%- if layout.logo -%}
75-
{{layout.logo}}
76-
{%- else -%}
77-
{{static_root_path | safe}}rust-logo{{page.resource_suffix}}.png
78-
{%- endif -%}
79-
' alt='logo'> {#- -#}
73+
<img src='
74+
{%- if layout.logo -%}
75+
{{layout.logo}}
76+
{%- else -%}
77+
{{static_root_path | safe}}rust-logo{{page.resource_suffix}}.png
78+
{%- endif -%}
79+
' alt='logo'> {#- -#}
8080
</div> {#- -#}
8181
</a> {#- -#}
8282
{{- sidebar | safe -}}
8383
</nav> {#- -#}
8484
<main> {#- -#}
8585
<div class="main-inner"> {#- -#}
86-
<nav class="sub"> {#- -#}
87-
<div class="theme-picker"> {#- -#}
88-
<button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"> {#- -#}
89-
<img width="18" height="18" alt="Pick another theme!" {# -#}
90-
src="{{static_root_path | safe}}brush{{page.resource_suffix}}.svg"> {#- -#}
91-
</button> {#- -#}
92-
<div id="theme-choices" role="menu"></div> {#- -#}
93-
</div> {#- -#}
94-
<form class="search-form"> {#- -#}
95-
<div class="search-container"> {#- -#}
96-
<div>{%- if layout.generate_search_filter -%}
97-
<select id="crate-search"> {#- -#}
98-
<option value="All crates">All crates</option> {#- -#}
99-
</select> {#- -#}
100-
{%- endif -%}
101-
<input {# -#}
102-
class="search-input" {# -#}
103-
name="search" {# -#}
104-
autocomplete="off" {# -#}
105-
spellcheck="false" {# -#}
106-
placeholder="Click or press ‘S’ to search, ‘?’ for more options…" {# -#}
107-
type="search"> {#- -#}
108-
</div> {#- -#}
109-
<button type="button" id="help-button" title="help">?</button> {#- -#}
110-
<a id="settings-menu" href="{{page.root_path | safe}}settings.html" title="settings"> {#- -#}
111-
<img width="18" height="18" alt="Change settings" {# -#}
112-
src="{{static_root_path | safe}}wheel{{page.resource_suffix}}.svg"> {#- -#}
113-
</a> {#- -#}
86+
<div class="sub-container"> {#- -#}
87+
<a class="sub-logo-container rust-logo" href='{{page.root_path | safe}}{{krate_with_trailing_slash | safe}}index.html'> {#- -#}
88+
<img src='
89+
{%- if layout.logo -%}
90+
{{layout.logo}}
91+
{%- else -%}
92+
{{static_root_path | safe}}rust-logo{{page.resource_suffix}}.png
93+
{%- endif -%}
94+
' alt='logo'> {#- -#}
95+
</a> {#- -#}
96+
<nav class="sub"> {#- -#}
97+
<div class="theme-picker"> {#- -#}
98+
<button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"> {#- -#}
99+
<img width="18" height="18" alt="Pick another theme!" {# -#}
100+
src="{{static_root_path | safe}}brush{{page.resource_suffix}}.svg"> {#- -#}
101+
</button> {#- -#}
102+
<div id="theme-choices" role="menu"></div> {#- -#}
114103
</div> {#- -#}
115-
</form> {#- -#}
116-
</nav> {#- -#}
104+
<form class="search-form"> {#- -#}
105+
<div class="search-container"> {#- -#}
106+
<div>{%- if layout.generate_search_filter -%}
107+
<select id="crate-search"> {#- -#}
108+
<option value="All crates">All crates</option> {#- -#}
109+
</select> {#- -#}
110+
{%- endif -%}
111+
<input {# -#}
112+
class="search-input" {# -#}
113+
name="search" {# -#}
114+
disabled {# -#}
115+
autocomplete="off" {# -#}
116+
spellcheck="false" {# -#}
117+
placeholder="Click or press ‘S’ to search, ‘?’ for more options…" {# -#}
118+
type="search"> {#- -#}
119+
</div> {#- -#}
120+
<button type="button" id="help-button" title="help">?</button> {#- -#}
121+
<a id="settings-menu" href="{{page.root_path | safe}}settings.html" title="settings"> {#- -#}
122+
<img width="18" height="18" alt="Change settings" {# -#}
123+
src="{{static_root_path | safe}}wheel{{page.resource_suffix}}.svg"> {#- -#}
124+
</a> {#- -#}
125+
</div> {#- -#}
126+
</form> {#- -#}
127+
</nav> {#- -#}
128+
</div> {#- -#}
117129
<section id="main" class="content">{{- content | safe -}}</section> {#- -#}
118130
<section id="search" class="content hidden"></section> {#- -#}
119131
</div> {#- -#}

0 commit comments

Comments
 (0)