From b029eeadabe0877df6ec11443c68743f1494bc40 Mon Sep 17 00:00:00 2001
From: Ben Schlegel <31989404+benschlegel@users.noreply.github.com>
Date: Wed, 20 Sep 2023 20:55:29 +0000
Subject: [PATCH] feat(explorer): improve accessibility and consistency (+ bug fix) (#488)
---
quartz/components/Explorer.tsx | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/quartz/components/Explorer.tsx b/quartz/components/Explorer.tsx
index 346bd75..bc4855e 100644
--- a/quartz/components/Explorer.tsx
+++ b/quartz/components/Explorer.tsx
@@ -6,7 +6,7 @@
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 @@
}
},
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("")
@@ -78,7 +79,7 @@
data-savestate={opts.useSavedState}
data-tree={jsonTree}
>
- <h3>{opts.title}</h3>
+ <h1>{opts.title}</h1>
<svg
xmlns="http://www.w3.org/2000/svg"
width="14"
@@ -95,8 +96,9 @@
</svg>
</button>
<div id="explorer-content">
- <ul class="overflow">
+ <ul class="overflow" id="explorer-ul">
<ExplorerNode node={fileTree} opts={opts} fileData={fileData} />
+ <li id="explorer-end" />
</ul>
</div>
</div>
--
Gitblit v1.10.0