pages/reference: auto-open drawers when landing on top-level pages

This commit is contained in:
Matilde Park 2022-06-28 16:25:32 -07:00
parent fbe346b3c0
commit 608c875e23

View File

@ -115,8 +115,7 @@ const childPages = (thisLink, children, level = 0) => (
const pageTree = (thisLink, tree, level = 0) => {
const router = useRouter();
const firstCrumb = "/" + router.asPath.split("/").slice(1, -1).join("/");
const firstCrumb = "/" + router.asPath.split("/").slice(1).join("/");
const includesThisPage = firstCrumb.includes(thisLink);
const isThisPage = router.asPath === thisLink;
const [isOpen, toggleTree] = useState(includesThisPage);