Skip to content

Commit

Permalink
Rollup merge of #104516 - notriddle:notriddle/flex-basis-sidebar-widt…
Browse files Browse the repository at this point in the history
…h, r=GuillaumeGomez

rustdoc: clean up sidebar width CSS

This commit takes advantage of the ability to set [flex-basis] to a specific length instead of setting it to `auto` and changing min-/max-width, and setting flex-grow/-shrink both to 0.

This PR should not cause any visual changes.

preview: https://notriddle.com/notriddle-rustdoc-demos/flex-basis-sidebar-width/std/index.html

[flex-basis]: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis
  • Loading branch information
matthiaskrgr committed Nov 18, 2022
2 parents 5a8bc0b + ebee589 commit 5977fbb
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,7 @@ img {

.sidebar {
font-size: 0.875rem;
width: 200px;
min-width: 200px;
flex: 0 0 200px;
overflow-y: scroll;
position: sticky;
height: 100vh;
Expand All @@ -394,12 +393,7 @@ img {
}

.rustdoc.source .sidebar {
width: 50px;
min-width: 0px;
max-width: 300px;
flex-grow: 0;
flex-shrink: 0;
flex-basis: auto;
flex-basis: 50px;
border-right: 1px solid;
overflow-x: hidden;
/* The sidebar is by default hidden */
Expand All @@ -420,7 +414,7 @@ img {

.source-sidebar-expanded .source .sidebar {
overflow-y: auto;
width: 300px;
flex-basis: 300px;
}

.source-sidebar-expanded .source .sidebar > *:not(#sidebar-toggle) {
Expand Down Expand Up @@ -1701,6 +1695,7 @@ in storage.js
z-index: 11;
/* Reduce height slightly to account for mobile topbar. */
height: calc(100vh - 45px);
width: 200px;
}

/* The source view uses a different design for the sidebar toggle, and doesn't have a topbar,
Expand Down

0 comments on commit 5977fbb

Please sign in to comment.