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
+7 -1
View File
@@ -17,6 +17,7 @@ function TreeNode({ doc }: { doc: Doc }) {
<li className={styles.listItem}> <li className={styles.listItem}>
{hasChildren ? ( {hasChildren ? (
<div className={styles.expandable}> <div className={styles.expandable}>
{doc.copy ? (
<a <a
href={`#${doc.title href={`#${doc.title
.replaceAll(' ', '-') .replaceAll(' ', '-')
@@ -25,6 +26,9 @@ function TreeNode({ doc }: { doc: Doc }) {
> >
{doc.title} {doc.title}
</a> </a>
) : (
<div>{doc.title}</div>
)}
<div <div
className={styles.chevronContainer} className={styles.chevronContainer}
onClick={() => setIsExpanded(!isExpanded)} onClick={() => setIsExpanded(!isExpanded)}
@@ -60,7 +64,7 @@ function TreeNode({ doc }: { doc: Doc }) {
)} )}
</div> </div>
</div> </div>
) : ( ) : doc.copy ? (
<a <a
href={`#${doc.title href={`#${doc.title
.replaceAll(' ', '-') .replaceAll(' ', '-')
@@ -69,6 +73,8 @@ function TreeNode({ doc }: { doc: Doc }) {
> >
{doc.title} {doc.title}
</a> </a>
) : (
<div>{doc.title}</div>
)} )}
{doc.children && {doc.children &&