Skip to content

Commit a9810ec

Browse files
GeoSotjulien-deramondmdo
authored
Use scrollspy on docs pages (#33428)
* use scrollspy on docs pages * Update colors by taking into account new dark mode * Restyle it * Update colors once more * Fix some color contrast issues Co-authored-by: Julien Déramond <juderamond@gmail.com> Co-authored-by: Mark Otto <markdotto@gmail.com>
1 parent 8befabb commit a9810ec

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

site/assets/scss/_syntax.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
--base05: #abb2bf;
2828
--base06: #b6bdca;
2929
--base07: #d19a66;
30-
--base08: #e06c75;
30+
--base08: #{$red-300};
3131
--base09: #d19a66;
3232
--base0A: #e5c07b;
3333
--base0B: #98c379;

site/assets/scss/_toc.scss

+19-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// stylelint-disable selector-max-type
1+
// stylelint-disable selector-max-type, selector-no-qualifying-type, selector-max-compound-selectors
22

33
.bd-toc {
44
@include media-breakpoint-up(lg) {
@@ -16,23 +16,34 @@
1616
ul {
1717
padding-left: 0;
1818
margin-bottom: 0;
19+
margin-left: -.75rem;
1920
list-style: none;
2021

2122
ul {
2223
padding-left: 1rem;
23-
margin-top: .25rem;
24-
}
25-
}
24+
margin-left: -1rem;
2625

27-
li {
28-
margin-bottom: .25rem;
26+
a {
27+
padding-left: 1.375rem;
28+
}
29+
}
2930
}
3031

3132
a {
33+
display: block;
34+
padding: .125rem 0 .125rem .625rem;
3235
color: inherit;
36+
text-decoration: none;
37+
border-left: .125rem solid transparent;
38+
39+
&:hover,
40+
&.active {
41+
color: var(--bd-toc-color);
42+
border-left-color: var(--bd-toc-color);
43+
}
3344

34-
&:not(:hover) {
35-
text-decoration: none;
45+
&.active {
46+
font-weight: 500;
3647
}
3748

3849
code {

site/assets/scss/_variables.scss

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ $bd-callout-variants: info, warning, danger !default;
1818
--bd-accent-rgb: #{to-rgb($bd-accent)};
1919
--bd-pink-rgb: #{to-rgb($pink-500)};
2020
--bd-teal-rgb: #{to-rgb($teal-500)};
21-
2221
--bd-violet-bg: var(--bd-violet);
22+
--bd-toc-color: var(--bd-violet);
2323
--bd-sidebar-link-bg: rgba(var(--bd-violet-rgb), .1);
2424
}
2525

2626
@include color-mode(dark, true) {
2727
--bd-violet: #{mix($bd-violet, $white, 75%)};
2828
--bd-violet-bg: #{$bd-violet};
29+
--bd-toc-color: var(--#{$prefix}emphasis-color);
2930
--bd-sidebar-link-bg: rgba(#{to-rgb(mix($bd-violet, $black, 75%))}, .5);
3031
}

site/layouts/_default/docs.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{ define "body_override" }}<body data-bs-spy="scroll" tabindex="0" data-bs-target="#TableOfContents">{{ end }}
12
{{ define "main" }}
23
<div class="container-xxl bd-gutter mt-3 my-md-4 bd-layout">
34
<aside class="bd-sidebar">

0 commit comments

Comments
 (0)