fix: only add link in side bar if has content or children otherwise just a div

This commit is contained in:
Stevan Freeborn
2023-04-25 07:54:34 -05:00
parent e9658b0ac3
commit 99a0508e5c
+15 -9
View File
@@ -17,14 +17,18 @@ function TreeNode({ doc }: { doc: Doc }) {
<li className={styles.listItem}>
{hasChildren ? (
<div className={styles.expandable}>
<a
href={`#${doc.title
.replaceAll(' ', '-')
.toLowerCase()}`}
className={styles.link}
>
{doc.title}
</a>
{doc.copy ? (
<a
href={`#${doc.title
.replaceAll(' ', '-')
.toLowerCase()}`}
className={styles.link}
>
{doc.title}
</a>
) : (
<div>{doc.title}</div>
)}
<div
className={styles.chevronContainer}
onClick={() => setIsExpanded(!isExpanded)}
@@ -60,7 +64,7 @@ function TreeNode({ doc }: { doc: Doc }) {
)}
</div>
</div>
) : (
) : doc.copy ? (
<a
href={`#${doc.title
.replaceAll(' ', '-')
@@ -69,6 +73,8 @@ function TreeNode({ doc }: { doc: Doc }) {
>
{doc.title}
</a>
) : (
<div>{doc.title}</div>
)}
{doc.children &&