fix(nit): make defaultOptions on explorer not a function
This commit is contained in:
parent
cc31a40b0c
commit
1bf7e3d8b3
@ -6,7 +6,7 @@ import script from "./scripts/explorer.inline"
|
|||||||
import { ExplorerNode, FileNode, Options } from "./ExplorerNode"
|
import { ExplorerNode, FileNode, Options } from "./ExplorerNode"
|
||||||
|
|
||||||
// Options interface defined in `ExplorerNode` to avoid circular dependency
|
// Options interface defined in `ExplorerNode` to avoid circular dependency
|
||||||
const defaultOptions = (): Options => ({
|
const defaultOptions = {
|
||||||
title: "Explorer",
|
title: "Explorer",
|
||||||
folderClickBehavior: "collapse",
|
folderClickBehavior: "collapse",
|
||||||
folderDefaultState: "collapsed",
|
folderDefaultState: "collapsed",
|
||||||
@ -23,11 +23,12 @@ const defaultOptions = (): Options => ({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
order: ["filter", "map", "sort"],
|
order: ["filter", "map", "sort"],
|
||||||
})
|
} satisfies Options
|
||||||
|
|
||||||
export default ((userOpts?: Partial<Options>) => {
|
export default ((userOpts?: Partial<Options>) => {
|
||||||
function Explorer({ allFiles, displayClass, fileData }: QuartzComponentProps) {
|
function Explorer({ allFiles, displayClass, fileData }: QuartzComponentProps) {
|
||||||
// Parse config
|
// Parse config
|
||||||
const opts: Options = { ...defaultOptions(), ...userOpts }
|
const opts: Options = { ...defaultOptions, ...userOpts }
|
||||||
|
|
||||||
// Construct tree from allFiles
|
// Construct tree from allFiles
|
||||||
const fileTree = new FileNode("")
|
const fileTree = new FileNode("")
|
||||||
|
Loading…
Reference in New Issue
Block a user