Skip to content

Commit 34984a6

Browse files
committed
Use folder icon instead of hamburger and sidebar
1 parent 66779ff commit 34984a6

File tree

2 files changed

+32
-20
lines changed

2 files changed

+32
-20
lines changed

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

+26-17
Original file line numberDiff line numberDiff line change
@@ -1531,9 +1531,8 @@ a.tooltip:hover::after {
15311531
position: sticky;
15321532
top: 0;
15331533
display: flex;
1534-
padding: 8px;
1535-
padding-left: 48px;
1536-
padding-bottom: 7px;
1534+
padding: 8px 8px 0 48px;
1535+
margin-bottom: 7px;
15371536
background: var(--sidebar-background-color);
15381537
border-bottom: 1px solid var(--border-color);
15391538
}
@@ -1793,6 +1792,30 @@ However, it's not needed with smaller screen width because the doc/code block is
17931792
margin-top: 16px;
17941793
}
17951794

1795+
/* sidebar button opens modal
1796+
use hamburger button */
1797+
.src #sidebar-button > a:before, .sidebar-menu-toggle:before {
1798+
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
1799+
viewBox="0 0 22 22" fill="none" stroke="black">\
1800+
<path d="M3,5h16M3,11h16M3,17h16" stroke-width="2.75"/></svg>');
1801+
opacity: 0.75;
1802+
}
1803+
.sidebar-menu-toggle:hover:before,
1804+
.sidebar-menu-toggle:active:before,
1805+
.sidebar-menu-toggle:focus:before {
1806+
opacity: 1;
1807+
}
1808+
1809+
/* src sidebar button opens a folder view */
1810+
.src #sidebar-button > a:before {
1811+
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
1812+
viewBox="0 0 22 22" fill="none" stroke="black">\
1813+
<path d="M16,9v-4h-6v-1l-2,-2h-4l-2,2v16h13L21,9h-15L2,19" stroke-width="1.25"/>\
1814+
<path d="M15,7h-11v3" stroke-width="0.75"/>\
1815+
<path d="M3.75,10v1.25" stroke-width="0.375"/></svg>');
1816+
opacity: 0.75;
1817+
}
1818+
17961819
/* Media Queries */
17971820

17981821
/* Make sure all the buttons line wrap at the same time */
@@ -1965,20 +1988,6 @@ in src-script.js and main.js
19651988
background: var(--main-background-color);
19661989
}
19671990

1968-
/* sidebar button opens modal
1969-
use hamburger button */
1970-
.src #sidebar-button > a:before, .sidebar-menu-toggle:before {
1971-
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
1972-
viewBox="0 0 22 22" fill="none" stroke="black">\
1973-
<path d="M3,5h16M3,11h16M3,17h16" stroke-width="2.75"/></svg>');
1974-
opacity: 0.75;
1975-
}
1976-
.src #sidebar-button > a:hover:before, .sidebar-menu-toggle:hover:before,
1977-
.src #sidebar-button > a:active:before, .sidebar-menu-toggle:active:before,
1978-
.src #sidebar-button > a:focus:before, .sidebar-menu-toggle:focus:before {
1979-
opacity: 1;
1980-
}
1981-
19821991
/* Display an alternating layout on tablets and phones */
19831992
.item-table, .item-row, .item-table > li, .item-table > li > div,
19841993
.search-results > a, .search-results > a > div {

tests/rustdoc-gui/source-code-page.goml

+6-3
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ store-property: (".src-sidebar-title", {
152152
})
153153
call-function: ("check-sidebar-dir-entry", {
154154
"x": 0,
155-
"y": |source_sidebar_title_y| + |source_sidebar_title_height|,
155+
// margin = 7px
156+
"y": |source_sidebar_title_y| + |source_sidebar_title_height| + 7,
156157
})
157158

158159
// Check the search form
@@ -180,7 +181,8 @@ store-property: (".src-sidebar-title", {
180181
})
181182
call-function: ("check-sidebar-dir-entry", {
182183
"x": 0,
183-
"y": |source_sidebar_title_y| + |source_sidebar_title_height|,
184+
// margin = 7px
185+
"y": |source_sidebar_title_y| + |source_sidebar_title_height| + 7,
184186
})
185187

186188
// Tiny, phone mobile gets a different display where the logo is stacked on top.
@@ -194,5 +196,6 @@ store-property: (".src-sidebar-title", {
194196
})
195197
call-function: ("check-sidebar-dir-entry", {
196198
"x": 0,
197-
"y": |source_sidebar_title_y| + |source_sidebar_title_height|,
199+
// margin = 7px
200+
"y": |source_sidebar_title_y| + |source_sidebar_title_height| + 7,
198201
})

0 commit comments

Comments
 (0)