fix(nit): make defaultOptions on explorer not a function

This commit is contained in:
Jacky Zhao 2023-09-19 10:22:39 -07:00
parent cc31a40b0c
commit 1bf7e3d8b3

View File

@ -6,7 +6,7 @@ import script from "./scripts/explorer.inline"
import { ExplorerNode, FileNode, Options } from "./ExplorerNode"
// Options interface defined in `ExplorerNode` to avoid circular dependency
const defaultOptions = (): Options => ({
const defaultOptions = {
title: "Explorer",
folderClickBehavior: "collapse",
folderDefaultState: "collapsed",
@ -23,11 +23,12 @@ const defaultOptions = (): Options => ({
}
},
order: ["filter", "map", "sort"],
})
} satisfies Options
export default ((userOpts?: Partial<Options>) => {
function Explorer({ allFiles, displayClass, fileData }: QuartzComponentProps) {
// Parse config
const opts: Options = { ...defaultOptions(), ...userOpts }
const opts: Options = { ...defaultOptions, ...userOpts }
// Construct tree from allFiles
const fileTree = new FileNode("")