mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-21 01:53:26 +00:00
Self-review
This commit is contained in:
@@ -73,15 +73,22 @@ export function StickyViewGrid({ className, header, children }: StickyViewGridPr
|
||||
useScrollListener(syncStickyLayout, bodyScrollRef);
|
||||
|
||||
useEffect(() => {
|
||||
const elements = [bodyScrollRef.current, bodyTableRef.current].filter(
|
||||
(element): element is HTMLDivElement => Boolean(element)
|
||||
);
|
||||
if (elements.length === 0) {
|
||||
const bodyScrollElement = bodyScrollRef.current;
|
||||
const bodyTableElement = bodyTableRef.current;
|
||||
|
||||
if (!bodyScrollElement && !bodyTableElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
const resizeObserver = new ResizeObserver(syncStickyLayout);
|
||||
elements.forEach((element) => resizeObserver.observe(element));
|
||||
|
||||
if (bodyScrollElement) {
|
||||
resizeObserver.observe(bodyScrollElement);
|
||||
}
|
||||
|
||||
if (bodyTableElement) {
|
||||
resizeObserver.observe(bodyTableElement);
|
||||
}
|
||||
|
||||
return () => {
|
||||
resizeObserver.disconnect();
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
@reference "../../RootLayout/globals.css";
|
||||
|
||||
.tableScrollArea {
|
||||
animation: detect-scroll linear;
|
||||
animation-timeline: scroll(self x);
|
||||
overscroll-behavior-x: none;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user