Skip to content

Commit f842650

Browse files
committed
more
1 parent 0947c70 commit f842650

File tree

3 files changed

+58
-65
lines changed

3 files changed

+58
-65
lines changed

site/src/components/header/Navigation.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const { addedIn, layout, title } = Astro.props
4646
<BootstrapWhiteFillIcon class="d-block my-1" height={32} width={40} />
4747
</a>
4848

49-
{/* Search and main nav toggle */}
49+
{/* Search and nav toggles */}
5050
<div class="d-flex gap-3">
5151
<div class="bd-search" id="docsearch" data-bd-docs-version={getConfig().docs_version}></div>
5252

site/src/layouts/DocsLayout.astro

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -112,30 +112,35 @@ if (currentPageIndex < allPages.length - 1) {
112112
</div>
113113
</div>
114114

115-
<div class="vstack bd-toc mt-3 mb-5 lg:my-0 lg:mb-5 sm:px-1 fg-3">
116-
<div class="overflow-y-auto">
117-
{
118-
frontmatter.toc && headings && (
119-
<button
120-
class="btn-sm btn-subtle mb-2 bd-toc-toggle lg:d-none"
121-
type="button"
122-
data-bs-toggle="collapse"
123-
data-bs-target="#tocContents"
124-
aria-expanded="false"
125-
aria-controls="tocContents"
126-
>
127-
On this page
128-
<svg class="bi lg:d-none ms-2" aria-hidden="true">
129-
<use href="#chevron-expand" />
130-
</svg>
131-
</button>
132-
<div class="collapse bd-toc-collapse" id="tocContents">
133-
<nav id="TableOfContents" aria-labelledby="docs-tocs">
134-
<TableOfContents headings={headings} />
135-
</nav>
136-
</div>
137-
)
138-
}
115+
<div class="lg:d-none d-flex justify-content-center bd-toc-toggle">
116+
<button
117+
class="btn-solid theme-secondary rounded-pill px-5"
118+
type="button"
119+
data-bs-toggle="offcanvas"
120+
data-bs-target="#bdTocSidebar"
121+
aria-controls="bdTocSidebar"
122+
>
123+
<svg class="bi" aria-hidden="true"><use href="#list"></use></svg>
124+
On this page…
125+
</button>
126+
</div>
127+
128+
<div class="bd-toc mt-3 mb-5 lg:my-0 lg:mb-5 sm:px-1">
129+
<div class="lg:offcanvas offcanvas-bottom" tabindex="-1" id="bdTocSidebar" aria-labelledby="bdTocOffcanvasLabel">
130+
<div class="offcanvas-header border-bottom">
131+
<h5 class="offcanvas-title" id="bdTocOffcanvasLabel">On this page</h5>
132+
<CloseButton dismiss="offcanvas" target="#bdTocSidebar" />
133+
</div>
134+
135+
<div class="offcanvas-body">
136+
{
137+
frontmatter.toc && headings && (
138+
<nav id="TableOfContents" aria-label="Table of contents">
139+
<TableOfContents headings={headings} />
140+
</nav>
141+
)
142+
}
143+
</div>
139144
</div>
140145
<Ads />
141146
</div>

site/src/scss/_toc.scss

Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@use "../../../scss/layout/breakpoints" as *;
2-
@use "../../../scss/mixins/border-radius" as *;
32

43
@layer custom {
54
.bd-toc {
@@ -11,8 +10,19 @@
1110
top: var(--bd-navbar-offset);
1211
right: 0;
1312
z-index: 2;
13+
display: flex;
14+
flex-direction: column;
1415
height: calc(100vh - 6em);
15-
// overflow-y: auto;
16+
padding-inline-end: .25rem;
17+
margin-inline-end: -.25rem;
18+
overflow-y: auto;
19+
}
20+
21+
@include media-breakpoint-down(lg) {
22+
.lg\:offcanvas {
23+
border-inline-start-color: var(--bs-border-color);
24+
box-shadow: var(--bs-box-shadow-lg);
25+
}
1626
}
1727

1828
.nav {
@@ -44,49 +54,27 @@
4454
}
4555
}
4656

47-
48-
.bd-toc-toggle {
49-
display: flex;
50-
align-items: center;
51-
52-
@include media-breakpoint-down(md) {
53-
justify-content: space-between;
54-
width: 100%;
57+
// stylelint-disable-next-line selector-id-pattern, selector-max-id
58+
#bdTocSidebar {
59+
@include media-breakpoint-up(lg) {
60+
flex: 1 1 auto;
61+
min-height: 0;
62+
overflow-y: auto;
5563
}
5664

5765
@include media-breakpoint-down(lg) {
58-
color: var(--bs-color-body);
59-
border: 1px solid var(--bs-border-color);
60-
@include border-radius(var(--bs-border-radius));
61-
62-
&:hover,
63-
&:focus,
64-
&:active,
65-
&[aria-expanded="true"] {
66-
color: var(--bd-violet);
67-
background-color: var(--bs-bg-body);
68-
border-color: var(--bd-violet);
69-
}
70-
71-
&:focus,
72-
&[aria-expanded="true"] {
73-
box-shadow: 0 0 0 3px rgba(var(--bd-violet-rgb), .25);
74-
}
66+
height: 80dvh;
7567
}
7668
}
7769

78-
.bd-toc-collapse {
79-
@include media-breakpoint-down(lg) {
80-
nav {
81-
padding: 1.25rem 1.25rem 1.25rem 1rem;
82-
background-color: var(--bs-bg-subtle);
83-
border: 1px solid var(--bs-border-color);
84-
@include border-radius(var(--bs-border-radius));
85-
}
86-
}
87-
88-
@include media-breakpoint-up(lg) {
89-
display: block !important; // stylelint-disable-line declaration-no-important
90-
}
70+
.bd-toc-toggle {
71+
position: fixed;
72+
right: 0;
73+
bottom: 2rem;
74+
left: 0;
75+
z-index: 1030;
76+
margin-inline: auto;
77+
font-size: var(--font-size-sm);
78+
box-shadow: var(--bs-box-shadow-lg);
9179
}
9280
}

0 commit comments

Comments
 (0)