Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
abvthecity committed Jan 19, 2024
1 parent 556ec53 commit 718e299
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
2 changes: 1 addition & 1 deletion packages/ui/app/src/commons/AbsolutelyPositionedAnchor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const AbsolutelyPositionedAnchor: React.FC<AbsolutelyPositionedAnchor.Pro
)}
<Transition
show={wasJustCopied}
leave="duration-200 pointer-events-none transition-all"
leave="duration-200 pointer-events-none transition-all ease-in"
leaveFrom="opacity-100 translate-x-0"
leaveTo="opacity-0 -translate-x-2"
as={Fragment}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ export declare namespace NavigationContextProvider {
}>;
}

const smoothScrollIntoView = debounce(
(node: HTMLElement) => {
node.scrollIntoView({ behavior: "smooth" });
},
100,
{ leading: true, trailing: false }
);

export const NavigationContextProvider: React.FC<NavigationContextProvider.Props> = ({
resolvedPath,
children,
Expand Down Expand Up @@ -69,20 +61,14 @@ export const NavigationContextProvider: React.FC<NavigationContextProvider.Props

const selectedSlug = getFullSlugForNavigatable(activeNavigatable, { omitDefault: true, basePath });

const navigateToRoute = useRef((route: string, disableSmooth = false) => {
const navigateToRoute = useRef((route: string, _disableSmooth = false) => {
const [routeWithoutAnchor, _anchor] = route.split("#");
if (!userIsScrolling.current && routeWithoutAnchor != null) {
// fallback to "routeWithoutAnchor" if anchor is not detected (otherwise API reference will scroll to top)
const node = getRouteNode(route) ?? getRouteNode(routeWithoutAnchor);
if (node != null) {
if (disableSmooth) {
node.scrollIntoView({
behavior: "auto",
});
} else {
smoothScrollIntoView(node);
}
}
node?.scrollIntoView({
behavior: "auto",
});
}
justNavigatedTo.current = route;
});
Expand Down

0 comments on commit 718e299

Please sign in to comment.