mirror of
https://github.com/urbit/developers.urbit.org.git
synced 2024-09-11 13:55:59 +03:00
pages: nav on click, child pages are not bold
This commit is contained in:
parent
ae4e212319
commit
50752aebf9
@ -118,7 +118,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;
|
||||
@ -175,9 +175,11 @@ const pageTree = (thisLink, tree, level = 0) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<span onClick={() => toggleTree(!isOpen)}>
|
||||
<p className={`${headingItemClasses} cursor-pointer`}>{tree.title}</p>
|
||||
</span>
|
||||
<Link href={thisLink} passHref>
|
||||
<a onClick={() => toggleTree(!isOpen)}>
|
||||
<p className={`${headingItemClasses} cursor-pointer`}>{tree.title}</p>
|
||||
</a>
|
||||
</Link>
|
||||
<div className={activeClasses}>
|
||||
<ul className={""}>
|
||||
{tree.pages.map(({ title, slug }) => {
|
||||
@ -192,7 +194,7 @@ const pageTree = (thisLink, tree, level = 0) => {
|
||||
<li>
|
||||
<Link href={href} passHref>
|
||||
<a
|
||||
className={`relative font-semibold inline-block ${selectedClasses} ${pageItemClasses} `}
|
||||
className={`relative inline-block ${selectedClasses} ${pageItemClasses} `}
|
||||
>
|
||||
{title}
|
||||
</a>
|
||||
|
@ -171,9 +171,11 @@ const pageTree = (thisLink, tree, level = 0) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<span onClick={() => toggleTree(!isOpen)}>
|
||||
<p className={`${headingItemClasses} cursor-pointer`}>{tree.title}</p>
|
||||
</span>
|
||||
<Link href={thisLink} passHref>
|
||||
<a onClick={() => toggleTree(!isOpen)}>
|
||||
<p className={`${headingItemClasses} cursor-pointer`}>{tree.title}</p>
|
||||
</a>
|
||||
</Link>
|
||||
<div className={activeClasses}>
|
||||
<ul className={""}>
|
||||
{tree.pages.map(({ title, slug }) => {
|
||||
@ -188,7 +190,7 @@ const pageTree = (thisLink, tree, level = 0) => {
|
||||
<li>
|
||||
<Link href={href} passHref>
|
||||
<a
|
||||
className={`relative font-semibold inline-block ${selectedClasses} ${pageItemClasses} `}
|
||||
className={`relative inline-block ${selectedClasses} ${pageItemClasses} `}
|
||||
>
|
||||
{title}
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user