Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move theme picker button to the right and display it on all pages #94607

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,13 @@ nav.main .separator {
margin: 0 20px;
}
nav.sum { text-align: right; }
nav.sub form { display: inline; }
nav.sub form {
flex-grow: 1;
}

nav.sub form input {
height: 100%;
}

a {
text-decoration: none;
Expand Down Expand Up @@ -883,6 +889,7 @@ table,
position: relative;
display: flex;
height: 34px;
width: 100%;
}
.search-container > * {
height: 100%;
Expand Down Expand Up @@ -1379,16 +1386,13 @@ pre.rust {
}

.theme-picker {
position: absolute;
left: -38px;
top: 4px;
position: relative;
}

.theme-picker button {
outline: none;
}

#settings-menu, #help-button {
#settings-menu, #help-button, .theme-picker {
margin-left: 4px;
outline: none;
}
Expand Down Expand Up @@ -1425,7 +1429,7 @@ pre.rust {
display: none;
position: absolute;
left: 0;
top: 28px;
top: 31px;
border: 1px solid;
border-radius: 3px;
z-index: 1;
Expand Down Expand Up @@ -1831,12 +1835,6 @@ details.rustdoc-toggle[open] > summary.hideme::after {
margin-left: 32px;
}

/* Space is at a premium on mobile, so remove the theme-picker icon. */
#theme-picker {
display: none;
width: 0;
}

.content {
margin-left: 0px;
}
Expand Down
5 changes: 0 additions & 5 deletions src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,10 @@ function hideThemeButtonState() {

// Set up the theme picker list.
(function () {
if (!document.location.href.startsWith("file:///")) {
return;
}
var themeChoices = getThemesElement();
var themePicker = getThemePickerElement();
var availableThemes = getVar("themes").split(",");

removeClass(themeChoices.parentElement, "hidden");

function switchThemeButtonState() {
if (themeChoices.style.display === "block") {
hideThemeButtonState();
Expand Down
30 changes: 15 additions & 15 deletions src/librustdoc/html/templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,8 @@ <h2 class="location"></h2>
{%- endif -%}
</a> {#- -#}
<nav class="sub"> {#- -#}
<div class="theme-picker hidden"> {#- -#}
<button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"> {#- -#}
<img width="22" height="22" alt="Pick another theme!" {# -#}
src="{{static_root_path|safe}}brush{{page.resource_suffix}}.svg"> {#- -#}
</button> {#- -#}
<div id="theme-choices" role="menu"></div> {#- -#}
</div> {#- -#}
<form class="search-form"> {#- -#}
<div class="search-container"> {#- -#}
<div class="search-container"> {#- -#}
<form class="search-form"> {#- -#}
<span></span> {#- This empty span is a hacky fix for Safari - See #93184 -#}
<input {# -#}
class="search-input" {# -#}
Expand All @@ -125,13 +118,20 @@ <h2 class="location"></h2>
spellcheck="false" {# -#}
placeholder="Click or press ‘S’ to search, ‘?’ for more options…" {# -#}
type="search"> {#- -#}
<button type="button" id="help-button" title="help">?</button> {#- -#}
<a id="settings-menu" href="{{page.root_path|safe}}settings.html" title="settings"> {#- -#}
<img width="22" height="22" alt="Change settings" {# -#}
src="{{static_root_path|safe}}wheel{{page.resource_suffix}}.svg"> {#- -#}
</a> {#- -#}
</form> {#- -#}
<button type="button" id="help-button" title="help">?</button> {#- -#}
<div class="theme-picker"> {#- -#}
<button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"> {#- -#}
<img width="22" height="22" alt="Pick another theme!" {# -#}
src="{{static_root_path|safe}}brush{{page.resource_suffix}}.svg"> {#- -#}
</button> {#- -#}
<div id="theme-choices" role="menu"></div> {#- -#}
</div> {#- -#}
</form> {#- -#}
<a id="settings-menu" href="{{page.root_path|safe}}settings.html" title="settings"> {#- -#}
<img width="22" height="22" alt="Change settings" {# -#}
src="{{static_root_path|safe}}wheel{{page.resource_suffix}}.svg"> {#- -#}
</a> {#- -#}
</div> {#- -#}
</nav> {#- -#}
</div> {#- -#}
<section id="main-content" class="content">{{- content|safe -}}</section> {#- -#}
Expand Down