Skip to content

Commit

Permalink
add docs page
Browse files Browse the repository at this point in the history
  • Loading branch information
asanchezyali committed Aug 28, 2023
1 parent a2a13d9 commit 8e53cb6
Show file tree
Hide file tree
Showing 7 changed files with 349 additions and 375 deletions.
1 change: 1 addition & 0 deletions morpheus-client/components/Navbar/Navbar.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@use "styles/typography";

.navbarContainer {
position: fixed;
height: 80px;
min-height: 80px;
max-height: 80px;
Expand Down
4 changes: 2 additions & 2 deletions morpheus-client/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ const NavMenu = (props: NavMenuProps) => {
<Link className={getLinkStyles("gallery")} href={"/gallery"}>
Gallery
</Link>
<Link className={getLinkStyles("about")} href={"/about"}>
About
<Link className={getLinkStyles("about")} href={"/docs"}>
Docs
</Link>
</div>

Expand Down
33 changes: 33 additions & 0 deletions morpheus-client/hooks/useHeadsObserver.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { useEffect, useState, useRef } from "react";

function useHeadsObserver() {
const observer = useRef<IntersectionObserver | null>(null);
const [activeId, setActiveId] = useState("");

useEffect(() => {
const handleObserver = (entries: IntersectionObserverEntry[]) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
setActiveId(entry.target.id);
}
});
};

observer.current = new IntersectionObserver(handleObserver, {
rootMargin: "-20% 0% -35% 0px",
});

const elements = document.querySelectorAll("h2, h3, h4");
elements.forEach((elem) => {
if (observer.current) {
observer.current.observe(elem);
}
});

return () => observer.current?.disconnect();
}, []);

return { activeId };
}

export default useHeadsObserver;
232 changes: 0 additions & 232 deletions morpheus-client/pages/about.tsx

This file was deleted.

Loading

0 comments on commit 8e53cb6

Please sign in to comment.