Skip to content

Commit aa8af34

Browse files
committed
rustdoc: add a handle that makes sidebar resizing more obvious
1 parent ae9173d commit aa8af34

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,22 @@ img {
519519
/* make sure there's a 1px gap between the scrollbar and resize handle */
520520
left: calc(var(--desktop-sidebar-width) + 1px);
521521
}
522+
/* visual indication that the sidebar can be resized */
523+
.sidebar-resize-hint {
524+
background-color: var(--sidebar-resize-hint-color);
525+
color:
526+
margin: 0 5px 5px 0;
527+
padding: 1px 2px 4px 0;
528+
margin-top: 16px;
529+
border-width: 7px 6px 7px 1px;
530+
border-style: solid;
531+
border-color: var(--sidebar-resize-hint-color);
532+
border-radius: 0 5px 5px 0;
533+
font-size: 10px;
534+
/* allow to stack with `.sidebar-resizer.active::before` */
535+
position: abosolute;
536+
cursor: e-resize;
537+
}
522538

523539
.rustdoc.src .sidebar-resizer {
524540
/* when closed, place resizer glow on top of the normal src sidebar border (no need to
@@ -585,11 +601,13 @@ img {
585601
margin-left: -140px;
586602
border-left: none;
587603
}
588-
.sidebar-resizer.active:before {
604+
.sidebar-resizer.active::before {
589605
border-left: solid 2px var(--sidebar-resizer-active);
590606
display: block;
591607
height: 100%;
592608
content: "";
609+
/* allow to stack with `.sidebar-resize-hint` */
610+
position: absolute;
593611
}
594612

595613
.sidebar, .mobile-topbar, .sidebar-menu-toggle,
@@ -2890,6 +2908,7 @@ by default.
28902908
--settings-button-border-focus: #717171;
28912909
--sidebar-background-color: #f5f5f5;
28922910
--sidebar-background-color-hover: #e0e0e0;
2911+
--sidebar-resize-hint-color: #000a;
28932912
--code-block-background-color: #f5f5f5;
28942913
--scrollbar-track-background-color: #dcdcdc;
28952914
--scrollbar-thumb-background-color: rgba(36, 37, 39, 0.6);
@@ -2995,6 +3014,7 @@ by default.
29953014
--settings-button-border-focus: #ffb900;
29963015
--sidebar-background-color: #505050;
29973016
--sidebar-background-color-hover: #676767;
3017+
--sidebar-resize-hint-color: #000a;
29983018
--code-block-background-color: #2A2A2A;
29993019
--scrollbar-track-background-color: #717171;
30003020
--scrollbar-thumb-background-color: rgba(32, 34, 37, .6);
@@ -3107,6 +3127,7 @@ Original by Dempfi (https://github.com/dempfi/ayu)
31073127
--settings-button-border-focus: #e0e0e0;
31083128
--sidebar-background-color: #14191f;
31093129
--sidebar-background-color-hover: rgba(70, 70, 70, 0.33);
3130+
--sidebar-resize-hint-color: #999;
31103131
--code-block-background-color: #191f26;
31113132
--scrollbar-track-background-color: transparent;
31123133
--scrollbar-thumb-background-color: #5c6773;

src/librustdoc/html/templates/page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ <h2>Files</h2> {# #}
114114
{% endif %}
115115
{{ sidebar|safe }}
116116
</nav> {# #}
117-
<div class="sidebar-resizer"></div> {# #}
117+
<div class="sidebar-resizer"><div class="sidebar-resize-hint"></div></div> {# #}
118118
<main>
119119
{% if page.css_class != "src" %}<div class="width-limiter">{% endif %}
120120
{# defined in storage.js to avoid duplicating complex UI across every page #}

0 commit comments

Comments
 (0)