Skip to content

Commit a8eb799

Browse files
committed
fix sidebar on smaller widths
1 parent f23f337 commit a8eb799

File tree

4 files changed

+23
-11
lines changed

4 files changed

+23
-11
lines changed

src/css/custom.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ body {
7373
}
7474
/* Rich's attempt to add scrollbar to nav */
7575
.sidebar_mhZE {
76-
padding-bottom: 4rem;
7776
height: 100% !important;
7877
}
7978
/* Make the navbar move with the page */

src/theme/DocItem/Layout/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export default function DocItemLayout({children}) {
111111
<DocItemPaginator />
112112
</div>
113113
</div>
114-
{docTOC.desktop && <div className="col col--3">{docTOC.desktop}</div>}
114+
{docTOC.desktop && <div className={clsx(styles.tocSidebar, 'col col--3')}>{docTOC.desktop}</div>}
115115
</div>
116116
);
117117
}

src/theme/DocItem/Layout/styles.module.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
@use '../../../css/breakpoints.scss' as breakpoints;
22

3+
.tocSidebar {
4+
display: none;
5+
}
6+
7+
@media (min-width: breakpoints.$mobile-breakpoint) {
8+
.tocSidebar {
9+
display: flex;
10+
}
11+
}
12+
13+
314
.docItemContainer header + *,
415
.docItemContainer article > *:first-child {
516
margin-top: 0;

src/theme/DocItem/TOC/Desktop/styles.module.scss

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@
1010
display: none; // don't show by default on mobile
1111
}
1212

13-
.docTOCContainer {
14-
height: calc(100vh - (var(--ifm-navbar-height) + 2rem));
15-
display: flex;
16-
flex-flow: column nowrap;
17-
position: sticky;
18-
gap: 24px;
19-
padding-bottom: 3.5rem;
20-
overflow-y: auto;
21-
top: calc(var(--ifm-navbar-height) + 1rem);
13+
@media screen and (min-width: breakpoints.$mobile-breakpoint) {
14+
.docTOCContainer {
15+
height: calc(100vh - (var(--ifm-navbar-height) + 2rem));
16+
display: flex;
17+
flex-flow: column nowrap;
18+
position: sticky;
19+
gap: 24px;
20+
padding-bottom: 3.5rem;
21+
overflow-y: auto;
22+
top: calc(var(--ifm-navbar-height) + 1rem);
23+
}
2224
}
2325

2426
.docCloudCardHeader {

0 commit comments

Comments
 (0)