Skip to content

Commit 61bbe89

Browse files
committed
Add folder icon
Resolves #2741
1 parent 70243b4 commit 61bbe89

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### Features
44

55
- Added `headings` option to control optional headings, #2729.
6+
- Added a folder icon to page navigation elements which are not links, #2741.
67

78
### Bug Fixes
89

scripts/build_themes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const esbuild = require("esbuild");
33
const fs = require("fs");
44

5-
const watch = process.argv.slice(2).includes("--watch");
5+
const watch = process.argv.slice(2).some((t) => t == "--watch" || t == "-w");
66

77
// It's convenient to be able to build the themes in watch mode without rebuilding the whole docs
88
// to test some change to the frontend JS.

src/lib/output/themes/default/assets/typedoc/Navigation.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ function addNavText(
103103
}
104104
a.appendChild(document.createElement("span")).textContent = el.text;
105105
} else {
106-
parent.appendChild(document.createElement("span")).textContent =
107-
el.text;
106+
const span = parent.appendChild(document.createElement("span"));
107+
span.innerHTML = `<svg width="20" height="20" viewBox="0 0 24 24" fill="none" class="tsd-kind-icon"><use href="#icon-folder"></use></svg>`;
108+
span.appendChild(document.createElement("span")).textContent = el.text;
108109
}
109110
}

src/lib/output/themes/default/partials/icon.tsx

+11-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function buildRefIcons<T extends Record<string, () => JSX.Element>>(
4747
}
4848

4949
export const icons: Record<
50-
ReflectionKind | "chevronDown" | "checkbox" | "menu" | "search" | "chevronSmall" | "anchor",
50+
ReflectionKind | "chevronDown" | "checkbox" | "menu" | "search" | "chevronSmall" | "anchor" | "folder",
5151
() => JSX.Element
5252
> = {
5353
[ReflectionKind.Accessor]: () =>
@@ -186,14 +186,21 @@ export const icons: Record<
186186
),
187187
[ReflectionKind.Document]: () =>
188188
kindIcon(
189-
<g stroke="var(--color-text)" fill="var(--color-icon-background)">
190-
<polygon points="6,5 6,19 18,19, 18,9 15,5" />
191-
<line x1="9" y1="9" x2="14" y2="9" />
189+
<g stroke="var(--color-text)" fill="none" stroke-width="1.5">
190+
<polygon points="6,5 6,19 18,19, 18,10 13,5" />
191+
<line x1="9" y1="9" x2="13" y2="9" />
192192
<line x1="9" y1="12" x2="15" y2="12" />
193193
<line x1="9" y1="15" x2="15" y2="15" />
194194
</g>,
195195
"var(--color-document)",
196196
),
197+
folder: () =>
198+
kindIcon(
199+
<g stroke="var(--color-text)" fill="none" stroke-width="1.5">
200+
<polygon points="5,5 10,5 12,8 19,8 19,18 5,18" />
201+
</g>,
202+
"var(--color-document)",
203+
),
197204
chevronDown: () => (
198205
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
199206
<path

0 commit comments

Comments
 (0)