Skip to content

Commit 934e86b

Browse files
Unify sidebar buttons to use the same image
1 parent 821925e commit 934e86b

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

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

+22-21
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ xmlns="http://www.w3.org/2000/svg" fill="black" height="18px">\
5555
--collapse-arrow-image: url('data:image/svg+xml,<svg width="16" height="16" viewBox="0 0 16 16" \
5656
enable-background="new 0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path fill="none" \
5757
d="M3,8l4,4l4,-4m-4,4M3,4l4,4l4,-4" stroke="black" stroke-width="2"/></svg>');
58+
--hamburger-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
59+
viewBox="0 0 22 22" fill="none" stroke="black">\
60+
<path d="M3,5h16M3,11h16M3,17h16" stroke-width="2.75"/></svg>');
5861
}
5962

6063
:root.sans-serif {
@@ -2001,9 +2004,11 @@ a.tooltip:hover::after {
20012004
display: flex;
20022005
margin-right: 4px;
20032006
position: fixed;
2004-
left: 6px;
20052007
height: 34px;
20062008
width: 34px;
2009+
}
2010+
.hide-sidebar #sidebar-button {
2011+
left: 6px;
20072012
background-color: var(--main-background-color);
20082013
z-index: 1;
20092014
}
@@ -2019,6 +2024,8 @@ a.tooltip:hover::after {
20192024
align-items: center;
20202025
justify-content: center;
20212026
flex-direction: column;
2027+
}
2028+
#settings-menu > a, #help-button > a, button#toggle-all-docs {
20222029
border: 1px solid transparent;
20232030
border-radius: var(--button-border-radius);
20242031
color: var(--main-color);
@@ -2031,14 +2038,15 @@ a.tooltip:hover::after {
20312038
min-width: 0;
20322039
}
20332040
#sidebar-button > a {
2034-
background-color: var(--button-background-color);
2035-
border-color: var(--border-color);
2041+
background-color: var(--sidebar-background-color);
20362042
width: 33px;
20372043
}
2044+
#sidebar-button > a:hover, #sidebar-button > a:focus-visible {
2045+
background-color: var(--main-background-color);
2046+
}
20382047

20392048
#settings-menu > a:hover, #settings-menu > a:focus-visible,
20402049
#help-button > a:hover, #help-button > a:focus-visible,
2041-
#sidebar-button > a:hover, #sidebar-button > a:focus-visible,
20422050
button#toggle-all-docs:hover, button#toggle-all-docs:focus-visible {
20432051
border-color: var(--settings-button-border-focus);
20442052
text-decoration: none;
@@ -2402,28 +2410,16 @@ However, it's not needed with smaller screen width because the doc/code block is
24022410
use hamburger button */
24032411
.src #sidebar-button > a::before, .sidebar-menu-toggle::before {
24042412
/* hamburger button image */
2405-
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
2406-
viewBox="0 0 22 22" fill="none" stroke="black">\
2407-
<path d="M3,5h16M3,11h16M3,17h16" stroke-width="2.75"/></svg>');
2413+
content: var(--hamburger-image);
24082414
opacity: 0.75;
2415+
filter: var(--mobile-sidebar-menu-filter);
24092416
}
24102417
.sidebar-menu-toggle:hover::before,
24112418
.sidebar-menu-toggle:active::before,
24122419
.sidebar-menu-toggle:focus::before {
24132420
opacity: 1;
24142421
}
24152422

2416-
/* src sidebar button opens a folder view */
2417-
.src #sidebar-button > a::before {
2418-
/* folder image */
2419-
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
2420-
viewBox="0 0 22 22" fill="none" stroke="black">\
2421-
<path d="M16,9v-4h-6v-1l-2,-2h-4l-2,2v16h13L21,9h-15L2,19" stroke-width="1.25"/>\
2422-
<path d="M15,7h-11v3" stroke-width="0.75"/>\
2423-
<path d="M3.75,10v1.25" stroke-width="0.375"/></svg>');
2424-
opacity: 0.75;
2425-
}
2426-
24272423
/* Media Queries */
24282424

24292425
/* Make sure all the buttons line wrap at the same time */
@@ -2608,9 +2604,6 @@ in src-script.js and main.js
26082604
width: 22px;
26092605
height: 22px;
26102606
}
2611-
.sidebar-menu-toggle::before {
2612-
filter: var(--mobile-sidebar-menu-filter);
2613-
}
26142607
.sidebar-menu-toggle:hover {
26152608
background: var(--main-background-color);
26162609
}
@@ -2668,6 +2661,14 @@ in src-script.js and main.js
26682661
margin: 0 0 -25px 0;
26692662
padding: var(--nav-sub-mobile-padding);
26702663
}
2664+
2665+
html:not(.src-sidebar-expanded) .src #sidebar-button > a {
2666+
background-color: var(--main-background-color);
2667+
}
2668+
html:not(.src-sidebar-expanded) .src #sidebar-button > a:hover,
2669+
html:not(.src-sidebar-expanded) .src #sidebar-button > a:focus-visible {
2670+
background-color: var(--sidebar-background-color);
2671+
}
26712672
}
26722673

26732674

0 commit comments

Comments
 (0)