Skip to content

Commit 213cca3

Browse files
committed
fix: actually better scrolling
1 parent 5ec70b0 commit 213cca3

File tree

11 files changed

+43
-38
lines changed

11 files changed

+43
-38
lines changed

website/src/components/Navbar/styles.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ $logo-size: 60px;
55

66
.navbar {
77
z-index: 10;
8-
position: fixed;
8+
position: sticky;
99
top: 0;
1010
width: 100%;
1111
height: $navbar-height;
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
@use "@/styles/mixins";
22
@use "@/components/Navbar/styles.module" as navbar;
33
@use "@/components/Sidebar/styles.module" as sidebar;
4+
@use "@/components/Toc/styles.module" as toc;
45

56
$navbar-height: navbar.$navbar-height;
67
$sidebar-width: sidebar.$desktop-sidebar-width;
8+
$toc-width: toc.$desktop-toc-width;
79

810
.contentContainer {
9-
padding: 2rem;
10-
margin: $navbar-height auto 0;
11-
width: 100%;
12-
max-width: 1200px - $sidebar-width; // TODO: pick less arbitrary value
11+
padding: 1rem;
12+
margin: 0 auto;
13+
width: calc(100% - #{$toc-width});
14+
max-width: 1024px; // TODO: pick less arbitrary value
1315

1416
@include mixins.desktop() {
15-
padding: 1rem;
17+
padding: 1rem 2rem;
1618
}
1719
}

website/src/layout/components/ContentContainer/styles.module.scss.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// AUTOGENERATED FILE -- DO NOT EDIT DIRECTLY
2-
32
declare namespace StylesModuleScssNamespace {
43
export interface IStylesModuleScss {
54
active: string;
@@ -8,11 +7,13 @@ declare namespace StylesModuleScssNamespace {
87
collapsed: string;
98
contentContainer: string;
109
desktop: string;
10+
heading: string;
1111
hidden: string;
1212
items: string;
1313
left: string;
1414
link: string;
1515
logo: string;
16+
nav: string;
1617
navItem: string;
1718
navbar: string;
1819
right: string;

website/src/layout/components/ContentWrapper/styles.module.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
@use "@/styles/mixins";
22
@use "@/components/Sidebar/styles.module" as sidebar;
3+
@use "@/components/Toc/styles.module" as toc;
34

45
$sidebar-width: sidebar.$desktop-sidebar-width;
6+
$toc-width: toc.$desktop-toc-width;
57

68
.contentWrapper {
79
width: 100%;
810
display: flex;
9-
11+
1012
@include mixins.desktop() {
1113
flex-grow: 1;
1214
max-width: calc(100% - #{$sidebar-width});

website/src/layout/components/ContentWrapper/styles.module.scss.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// AUTOGENERATED FILE -- DO NOT EDIT DIRECTLY
2-
32
declare namespace StylesModuleScssNamespace {
43
export interface IStylesModuleScss {
54
active: string;
@@ -8,8 +7,10 @@ declare namespace StylesModuleScssNamespace {
87
collapsed: string;
98
contentWrapper: string;
109
desktop: string;
10+
heading: string;
1111
items: string;
1212
link: string;
13+
nav: string;
1314
}
1415
}
1516

website/src/layout/components/SidebarContainer/styles.module.scss

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,22 @@ $navbar-height: navbar.$navbar-height;
66
$sidebar-width: sidebar.$desktop-sidebar-width;
77

88
.column {
9-
position: sticky;
10-
top: 0;
11-
padding-top: $navbar-height;
12-
13-
width: $sidebar-width;
14-
height: 100%;
15-
max-height: 100vh;
16-
17-
display: flex;
18-
flex-direction: column;
9+
@include mixins.desktop-only(block) {
10+
width: $sidebar-width;
11+
border-right: 1px solid #dddddd; // TODO: unify colors
12+
clip-path: inset(0);
13+
}
1914

2015
.container {
2116
@include mixins.desktop-only(flex) {
22-
flex-grow: 1;
23-
border-right: 1px solid #dddddd; // TODO: unify colors
24-
clip-path: inset(0);
17+
position: sticky;
18+
top: $navbar-height;
19+
width: 100%;
20+
height: 100%;
21+
max-height: calc(100vh - #{$navbar-height});
2522
flex-direction: column;
26-
27-
overflow-x: hidden;
23+
24+
overflow: hidden auto;
2825
@include mixins.scrollbar(4px);
2926
}
3027
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { tocContainer } from "./styles.module.scss";
1+
import { column, tocContainer } from "./styles.module.scss";
22

33
import type { ReactNode } from "react";
44

@@ -8,8 +8,8 @@ interface TocContainerProps {
88

99
export default function TocContainer ({ children }: TocContainerProps) {
1010
return (
11-
<aside className={tocContainer}>
12-
{children}
11+
<aside className={column}>
12+
<div className={tocContainer}>{children}</div>
1313
</aside>
1414
)
1515
}

website/src/layout/components/TocContainer/styles.module.scss

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,27 @@
55
$navbar-height: navbar.$navbar-height;
66
$toc-width: toc.$desktop-toc-width;
77

8+
.column {
9+
width: 100%;
10+
flex: 0 0 #{$toc-width};
11+
max-width: $toc-width;
12+
}
13+
814
.tocContainer {
915
@include mixins.desktop-only(flex) {
1016
$top: 1rem;
1117
$margin-bottom: 1rem;
1218

13-
flex: 0 0 #{$toc-width};
14-
1519
position: sticky;
1620
top: calc(#{$navbar-height} + #{$top});
17-
1821
max-height: calc(100vh - #{$navbar-height} - #{$top} - #{$margin-bottom});
1922

20-
margin-left: auto;
21-
margin-bottom: $margin-bottom;
23+
margin: $top 1rem $margin-bottom auto;
2224
border-left: 1px solid #dddddd;
2325

2426
flex-direction: column;
2527

26-
overflow-y: scroll;
28+
overflow-y: auto;
2729
@include mixins.scrollbar(4px);
2830
}
2931

website/src/layout/components/TocContainer/styles.module.scss.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// AUTOGENERATED FILE -- DO NOT EDIT DIRECTLY
2-
32
declare namespace StylesModuleScssNamespace {
43
export interface IStylesModuleScss {
54
active: string;
5+
column: string;
66
heading: string;
77
hidden: string;
88
items: string;

website/src/layout/pages/DocPage/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ export default function DocPage ({ breadcrumb, sidebar, code }: DocPageProps) {
3232
<SidebarContainer><Sidebar items={sidebar} activePath={asPath} /></SidebarContainer>
3333
<ContentWrapper>
3434
<ContentContainer>
35-
<MarkdownWrapper>
36-
<MDXContent />
37-
</MarkdownWrapper>
35+
<MarkdownWrapper>
36+
<MDXContent />
37+
</MarkdownWrapper>
3838
</ContentContainer>
3939
<TocContainer>
4040
<TocDesktop toc={toc} className={tocClassName} />

0 commit comments

Comments
 (0)