Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
Revert "feat: nav appears on page scroll (#537)" (#541)
Browse files Browse the repository at this point in the history
This reverts commit 500a196.
  • Loading branch information
gregfromstl authored Jul 30, 2024
1 parent e9a3c39 commit 7c5605c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 25 deletions.
9 changes: 3 additions & 6 deletions src/components/others/TableOfContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Link from "next/link";
import { cn } from "@/lib/utils";
import { useEffect, useRef, useState } from "react";
import { usePathname } from "next/navigation";
import { useScrollPosition } from "../../hooks/useScrollPosition";

/**
* Automatically query all the heading anchors inside the <main> and creates a table of contents
Expand All @@ -29,7 +28,6 @@ export function TableOfContentsSideBar(props: {
filterHeading?: (heading: HTMLHeadingElement) => boolean;
linkClassName?: string;
}) {
const scrollPosition = useScrollPosition();
const [nodes, setNodes] = useState<TableOfContentNode[]>([]);
const tocRef = useRef<HTMLDivElement>(null);
const pathname = usePathname();
Expand Down Expand Up @@ -108,13 +106,12 @@ export function TableOfContentsSideBar(props: {
observer.disconnect();
};
}, [pathname, filterHeading]);

return (
<nav
className={cn(
"hidden hrink-0 pt-6 xl:block text-sm",
"sticky top-sticky-top-height h-sidebar-height flex-col overflow-y-auto styled-scrollbar transition-opacity duration-300",
scrollPosition > 100 ? 'opacity-100' : 'opacity-0 pointer-events-none'
"sticky top-sticky-top-height h-sidebar-height flex-col overflow-y-auto styled-scrollbar",
)}
style={{
visibility: hideNav ? "hidden" : "visible",
Expand Down Expand Up @@ -174,7 +171,7 @@ function TOCLink(props: {
return (
<Link
className={cn(
"block overflow-hidden text-ellipsis font-medium text-f-300 transition-colors hover:text-f-100 data-[active='true']:text-accent-500 duration-300",
"block overflow-hidden text-ellipsis font-medium text-f-300 transition-colors hover:text-f-100 data-[active='true']:text-accent-500",
props.linkClassName,
)}
href={props.href}
Expand Down
19 changes: 0 additions & 19 deletions src/hooks/useScrollPosition.ts

This file was deleted.

0 comments on commit 7c5605c

Please sign in to comment.