Skip to content

Commit 89b66f9

Browse files
committed
Formatting
1 parent d79a534 commit 89b66f9

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

packages/gitbook/src/components/TableOfContents/TOCScroller.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@ import React from 'react';
44

55
import { ClassValue, tcls } from '@/lib/tailwind';
66

7-
const TOCScrollContainerRefContext = React.createContext<React.RefObject<HTMLDivElement> | null>(null);
7+
const TOCScrollContainerRefContext = React.createContext<React.RefObject<HTMLDivElement> | null>(
8+
null,
9+
);
810

911
function useTOCScrollContainerRefContext() {
1012
const ctx = React.useContext(TOCScrollContainerRefContext);
1113
if (!ctx) {
12-
throw new Error("Context `TOCScrollContainerRefContext` must be used within Provider");
14+
throw new Error('Context `TOCScrollContainerRefContext` must be used within Provider');
1315
}
1416
return ctx;
1517
}
1618

17-
export function TOCScrollContainer(props: {
18-
children: React.ReactNode;
19-
className?: ClassValue;
20-
}) {
19+
export function TOCScrollContainer(props: { children: React.ReactNode; className?: ClassValue }) {
2120
const { children, className } = props;
2221
const scrollContainerRef = React.createRef<HTMLDivElement>();
2322

@@ -67,8 +66,5 @@ function isOutOfView(tocItem: HTMLElement, tocContainer: HTMLElement) {
6766
const tocItemTop = tocItem.offsetTop;
6867
const containerTop = tocContainer.scrollTop;
6968
const containerBottom = containerTop + tocContainer.clientHeight;
70-
return (
71-
tocItemTop < containerTop ||
72-
tocItemTop > containerBottom
73-
);
69+
return tocItemTop < containerTop || tocItemTop > containerBottom;
7470
}

0 commit comments

Comments
 (0)