fix: only add link in side bar if has content or children otherwise just a div
This commit is contained in:
@@ -17,14 +17,18 @@ function TreeNode({ doc }: { doc: Doc }) {
|
|||||||
<li className={styles.listItem}>
|
<li className={styles.listItem}>
|
||||||
{hasChildren ? (
|
{hasChildren ? (
|
||||||
<div className={styles.expandable}>
|
<div className={styles.expandable}>
|
||||||
<a
|
{doc.copy ? (
|
||||||
href={`#${doc.title
|
<a
|
||||||
.replaceAll(' ', '-')
|
href={`#${doc.title
|
||||||
.toLowerCase()}`}
|
.replaceAll(' ', '-')
|
||||||
className={styles.link}
|
.toLowerCase()}`}
|
||||||
>
|
className={styles.link}
|
||||||
{doc.title}
|
>
|
||||||
</a>
|
{doc.title}
|
||||||
|
</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 &&
|
||||||
|
|||||||
Reference in New Issue
Block a user