From 5cc9253c41fda87ba473df7023567ba66ce3c32b Mon Sep 17 00:00:00 2001
From: Ben Schlegel <ben5.schlegel@gmail.com>
Date: Sun, 17 Sep 2023 14:41:23 +0000
Subject: [PATCH] docs(explorer): write docs for new features

---
 quartz/components/ExplorerNode.tsx |   19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/quartz/components/ExplorerNode.tsx b/quartz/components/ExplorerNode.tsx
index e1c8b8e..f8b99f0 100644
--- a/quartz/components/ExplorerNode.tsx
+++ b/quartz/components/ExplorerNode.tsx
@@ -2,6 +2,8 @@
 import { QuartzPluginData } from "../plugins/vfile"
 import { resolveRelative } from "../util/path"
 
+type OrderEntries = "sort" | "filter" | "map"
+
 export interface Options {
   title: string
   folderDefaultState: "collapsed" | "open"
@@ -10,6 +12,7 @@
   sortFn: (a: FileNode, b: FileNode) => number
   filterFn?: (node: FileNode) => boolean
   mapFn?: (node: FileNode) => void
+  order?: OrderEntries[]
 }
 
 type DataWrapper = {
@@ -73,18 +76,8 @@
    * @param filterFn function to filter tree with
    */
   filter(filterFn: (node: FileNode) => boolean) {
-    const filteredNodes: FileNode[] = []
-
-    const traverse = (node: FileNode) => {
-      if (filterFn(node)) {
-        filteredNodes.push(node)
-      }
-      node.children.forEach(traverse)
-    }
-
-    traverse(this)
-
-    this.children = filteredNodes
+    this.children = this.children.filter(filterFn)
+    this.children.forEach((child) => child.filter(filterFn))
   }
 
   /**
@@ -157,7 +150,7 @@
         // Single file node
         <li key={node.file.slug}>
           <a href={resolveRelative(fileData.slug!, node.file.slug!)} data-for={node.file.slug}>
-            {node.file.frontmatter?.title}
+            {node.name}
           </a>
         </li>
       ) : (

--
Gitblit v1.10.0