Skip to content

Commit 6ebe055

Browse files
committed
make ToC scrollable
1 parent f1c1a6b commit 6ebe055

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/components/common/Sticky.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const Sticky: React.FC<StickyProps> = ({ className, top, children }) => {
4949
top: fixed ? top : undefined,
5050
}}
5151
>
52-
{children}
52+
<div>{children}</div>
5353
</StickyBlock>
5454
);
5555
};

src/components/post/PostToc.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,21 @@ const Positioner = styled.div`
1919
`;
2020

2121
const PostTocBlock = styled(Sticky)`
22+
overflow-x: hidden;
23+
overflow-y: auto;
24+
bottom: 0;
2225
width: 240px;
2326
margin-left: 5rem;
24-
border-left: 2px solid ${palette.gray2};
25-
padding-left: 0.75rem;
2627
padding-top: 0.25rem;
2728
padding-bottom: 0.25rem;
2829
color: ${palette.gray6};
2930
line-height: 1.5;
3031
font-size: 0.875rem;
32+
33+
> div {
34+
padding-left: 0.75rem;
35+
border-left: 2px solid ${palette.gray2};
36+
}
3137
`;
3238

3339
const TocItem = styled.div<{ active: boolean }>`

0 commit comments

Comments
 (0)