15
15
--desktop-sidebar-width : 200px ;
16
16
--src-sidebar-width : 300px ;
17
17
--desktop-sidebar-z-index : 100 ;
18
+ --sidebar-elems-left-padding : 24px ;
18
19
}
19
20
20
21
/* See FiraSans-LICENSE.txt for the Fira Sans license. */
@@ -559,8 +560,11 @@ ul.block, .block li {
559
560
.sidebar > h2 a {
560
561
display : block;
561
562
padding : 0.25rem ; /* 4px */
562
- margin-left : -0.25rem ;
563
563
margin-right : 0.25rem ;
564
+ /* extend click target to far edge of screen (mile wide bar) */
565
+ border-left : solid var (--sidebar-elems-left-padding ) transparent;
566
+ margin-left : calc (-0.25rem - var (--sidebar-elems-left-padding ));
567
+ background-clip : border-box;
564
568
}
565
569
566
570
.sidebar h2 {
@@ -578,7 +582,7 @@ ul.block, .block li {
578
582
.sidebar-elems ,
579
583
.sidebar > .version ,
580
584
.sidebar > h2 {
581
- padding-left : 24 px ;
585
+ padding-left : var ( --sidebar-elems-left-padding ) ;
582
586
}
583
587
584
588
.sidebar a {
@@ -632,13 +636,56 @@ ul.block, .block li {
632
636
.sidebar-crate .logo-container {
633
637
/* The logo is expected to have 8px "slop" along its edges, so we can optically
634
638
center it. */
635
- margin : 0 -16px 0 -16px ;
639
+ margin : 0 calc (-16px - var (--sidebar-elems-left-padding ));
640
+ padding : 0 var (--sidebar-elems-left-padding );
636
641
text-align : center;
637
642
}
638
643
644
+ .sidebar-crate .logo-container img {
645
+ /* When in a horizontal logo lockup, the highlight color of the crate name menu item
646
+ extends underneath the actual logo (in a vertical lockup, that background highlight
647
+ extends to the left edge of the screen).
648
+
649
+ To prevent a weird-looking colored band from appearing under the logo, cover it up
650
+ with the sidebar's background. Additionally, the crate name extends slightly above
651
+ the logo, so that its highlight has a bit of space to let the ascenders breath while
652
+ also having those ascenders meet exactly with the top of the logo.
653
+
654
+ In ANSI art, make it look like this:
655
+ | ┌─────┐
656
+ | (R) │ std │
657
+ | └─────┘
658
+
659
+ Not like this (which would happen without the z-index):
660
+ | ┌────────┐
661
+ | (│ std │
662
+ | └────────┘
663
+
664
+ Not like this (which would happen without the background):
665
+ | ┌────────┐
666
+ | (R) std │
667
+ | └────────┘
668
+
669
+ Nor like this (which would happen without the negative margin):
670
+ | ─────────┐
671
+ | (R) │ std │
672
+ | └─────┘
673
+ */
674
+ margin-top : -16px ;
675
+ border-top : solid 16px transparent;
676
+ box-sizing : content-box;
677
+ position : relative;
678
+ background-color : var (--sidebar-background-color );
679
+ background-clip : border-box;
680
+ z-index : 1 ;
681
+ }
682
+
639
683
.sidebar-crate h2 a {
640
684
display : block;
641
- margin : 0 calc (-24px + 0.25rem ) 0 -0.2rem ;
685
+ /* extend click target to far edge of screen (mile wide bar) */
686
+ border-left : solid var (--sidebar-elems-left-padding ) transparent;
687
+ background-clip : border-box;
688
+ margin : 0 calc (-24px + 0.25rem ) 0 calc (-0.2rem - var (--sidebar-elems-left-padding ));
642
689
/* Align the sidebar crate link with the search bar, which have different
643
690
font sizes.
644
691
0 commit comments