Skip to content

Commit 51ed33d

Browse files
authored
Rollup merge of #75366 - GuillaumeGomez:help-button, r=jyn514
Add help button Part of #75197. Here is a screenshot of the result: ![Screenshot from 2020-08-10 16-53-20](https://user-images.githubusercontent.com/3050060/89796547-14112a00-db2a-11ea-9f25-57b30ab68f9b.png) r? @jyn514
2 parents dff868e + a34bc79 commit 51ed33d

File tree

6 files changed

+27
-11
lines changed

6 files changed

+27
-11
lines changed

src/librustdoc/html/layout.rs

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ pub fn render<T: Print, S: Print>(
9595
placeholder=\"Click or press ‘S’ to search, ‘?’ for more options…\" \
9696
type=\"search\">\
9797
</div>\
98+
<span class=\"help-button\">?</span>
9899
<a id=\"settings-menu\" href=\"{root_path}settings.html\">\
99100
<img src=\"{static_root_path}wheel{suffix}.svg\" \
100101
width=\"18\" \

src/librustdoc/html/static/main.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,9 @@ function defocusSearchBar() {
473473
}());
474474

475475
document.addEventListener("click", function(ev) {
476-
if (hasClass(ev.target, "collapse-toggle")) {
476+
if (hasClass(ev.target, "help-button")) {
477+
displayHelp(true, ev);
478+
} else if (hasClass(ev.target, "collapse-toggle")) {
477479
collapseDocs(ev.target, "toggle");
478480
} else if (hasClass(ev.target.parentNode, "collapse-toggle")) {
479481
collapseDocs(ev.target.parentNode, "toggle");

src/librustdoc/html/static/rustdoc.css

+14-4
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ a {
674674
}
675675
.search-container > div {
676676
display: inline-flex;
677-
width: calc(100% - 34px);
677+
width: calc(100% - 63px);
678678
}
679679
#crate-search {
680680
margin-top: 5px;
@@ -1250,14 +1250,24 @@ h4 > .notable-traits {
12501250
outline: none;
12511251
}
12521252

1253-
#settings-menu {
1253+
#settings-menu, .help-button {
12541254
position: absolute;
1255-
right: 0;
12561255
top: 10px;
1256+
}
1257+
1258+
#settings-menu {
1259+
right: 0;
12571260
outline: none;
12581261
}
12591262

1260-
#theme-picker, #settings-menu {
1263+
.help-button {
1264+
right: 30px;
1265+
font-family: "Fira Sans",sans-serif;
1266+
text-align: center;
1267+
font-size: 17px;
1268+
}
1269+
1270+
#theme-picker, #settings-menu, .help-button {
12611271
padding: 4px;
12621272
width: 27px;
12631273
height: 29px;

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ kbd {
492492
box-shadow-color: #c6cbd1;
493493
}
494494

495-
#theme-picker, #settings-menu {
495+
#theme-picker, #settings-menu, .help-button {
496496
border-color: #5c6773;
497497
background-color: #0f1419;
498498
}
@@ -502,7 +502,8 @@ kbd {
502502
}
503503

504504
#theme-picker:hover, #theme-picker:focus,
505-
#settings-menu:hover, #settings-menu:focus {
505+
#settings-menu:hover, #settings-menu:focus,
506+
.help-button:hover, .help-button:focus {
506507
border-color: #e0e0e0;
507508
}
508509

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -386,13 +386,14 @@ kbd {
386386
box-shadow-color: #c6cbd1;
387387
}
388388

389-
#theme-picker, #settings-menu {
389+
#theme-picker, #settings-menu, .help-button {
390390
border-color: #e0e0e0;
391391
background: #f0f0f0;
392392
}
393393

394394
#theme-picker:hover, #theme-picker:focus,
395-
#settings-menu:hover, #settings-menu:focus {
395+
#settings-menu:hover, #settings-menu:focus,
396+
.help-button:hover, .help-button:focus {
396397
border-color: #ffb900;
397398
}
398399

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -377,13 +377,14 @@ kbd {
377377
box-shadow-color: #c6cbd1;
378378
}
379379

380-
#theme-picker, #settings-menu {
380+
#theme-picker, #settings-menu, .help-button {
381381
border-color: #e0e0e0;
382382
background-color: #fff;
383383
}
384384

385385
#theme-picker:hover, #theme-picker:focus,
386-
#settings-menu:hover, #settings-menu:focus {
386+
#settings-menu:hover, #settings-menu:focus,
387+
.help-button:hover, .help-button:focus {
387388
border-color: #717171;
388389
}
389390

0 commit comments

Comments
 (0)