Skip to content

Commit 2d1e379

Browse files
committed
feat: fs sidebar
1 parent ec097c0 commit 2d1e379

33 files changed

Lines changed: 131 additions & 677 deletions

docs/app.config.ts

Lines changed: 17 additions & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { defineConfig } from "@solidjs/start/config";
33
import arraybuffer from "vite-plugin-arraybuffer";
44

55
import { createWithSolidBase, defineTheme } from "../src/config";
6-
import defaultTheme from "../src/default-theme";
6+
import defaultTheme, { DefaultThemeSidebarItem } from "../src/default-theme";
7+
import { createFilesystemSidebar, SidebarConfig } from "../src/config/sidebar";
78

89
const theme = defineTheme({
910
componentsPath: import.meta.resolve("./src/solidbase-theme"),
@@ -97,173 +98,23 @@ export default defineConfig(
9798
},
9899
],
99100
sidebar: {
100-
"/guide": [
101-
{
102-
title: "Overview",
103-
collapsed: false,
104-
items: [
105-
{
106-
title: "What is SolidBase?",
107-
link: "/",
108-
},
109-
{
110-
title: "Quick Start",
111-
link: "/quickstart",
112-
status: "new",
113-
},
114-
{
115-
title: "Add to an Existing Project",
116-
link: "/add-to-existing",
117-
},
118-
{
119-
title: "Configure Your App",
120-
link: "/config",
121-
},
122-
{
123-
title: "Project Structure",
124-
link: "/structure",
125-
},
126-
{
127-
title: "Deploy Your Site",
128-
link: "/deploy",
129-
},
130-
],
131-
},
132-
{
133-
title: "Features",
134-
collapsed: false,
135-
items: [
136-
{
137-
title: "Markdown Extensions",
138-
link: "/markdown",
139-
},
140-
{
141-
title: "Language Switcher",
142-
link: "/language-switcher",
143-
},
144-
{
145-
title: "Internationalisation",
146-
link: "/i18n",
147-
},
148-
{
149-
title: "Sitemap Generation",
150-
link: "/sitemap",
151-
},
152-
{
153-
title: "Dev",
154-
link: "/dev",
155-
},
156-
],
157-
},
158-
{
159-
title: "Customisation",
160-
collapsed: false,
161-
items: [
162-
{
163-
title: "Custom Themes",
164-
link: "/custom-themes",
165-
},
166-
{
167-
title: "Extending Themes",
168-
link: "/extending-themes",
169-
},
170-
],
171-
},
172-
],
173-
"/reference": [
174-
{
175-
title: "Reference",
176-
collapsed: false,
177-
items: [
178-
{
179-
title: "Configuration Options",
180-
link: "/config",
181-
},
182-
{
183-
title: "Frontmatter Config",
184-
link: "/frontmatter",
185-
},
186-
{
187-
title: "Runtime API",
188-
link: "/runtime-api",
189-
},
190-
],
191-
},
192-
{
193-
title: "Default Theme",
194-
collapsed: false,
195-
items: [
196-
{
197-
title: "Overview",
198-
link: "/default-theme",
199-
},
200-
{
201-
title: "CSS Variables",
202-
link: "/default-theme/css-variables",
203-
},
204-
{
205-
title: "Components",
206-
collapsed: false,
207-
items: [
208-
{
209-
title: "Article",
210-
link: "/default-theme/article",
211-
},
212-
{
213-
title: "Features",
214-
link: "/default-theme/features",
215-
},
216-
{
217-
title: "Footer",
218-
link: "/default-theme/footer",
219-
},
220-
{
221-
title: "Header",
222-
link: "/default-theme/header",
223-
},
224-
{
225-
title: "Hero",
226-
link: "/default-theme/hero",
227-
},
228-
{
229-
title: "Last Updated",
230-
link: "/default-theme/last-updated",
231-
},
232-
{
233-
title: "Link",
234-
link: "/default-theme/link",
235-
},
236-
{
237-
title: "Locale Selector",
238-
link: "/default-theme/locale-selector",
239-
},
240-
{
241-
title: "Sidebar",
242-
link: "/default-theme/sidebar",
243-
},
244-
{
245-
title: "Table of Contents",
246-
link: "/default-theme/toc",
247-
},
248-
{
249-
title: "Theme Selector",
250-
link: "/default-theme/theme-selector",
251-
},
252-
],
253-
},
254-
{
255-
title: "Landing",
256-
link: "/default-theme/landing",
257-
},
258-
{
259-
title: "Layout",
260-
link: "/default-theme/layout",
261-
},
262-
],
263-
},
264-
],
101+
"/guide": customFSSidebar("/guide", "Overview"),
102+
"/reference": customFSSidebar("/reference", "Reference"),
265103
},
266104
},
267105
},
268106
),
269107
);
108+
109+
110+
function customFSSidebar(route: string, title: string) {
111+
const sidebar = createFilesystemSidebar(route);
112+
113+
return [
114+
{
115+
title,
116+
items: sidebar.filter((i) => !("items" in i)),
117+
},
118+
...sidebar.filter((i) => ("items" in i))
119+
];
120+
}
File renamed without changes.
Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ nav: [
235235
The sidebar configuration allows you to create a structured sidebar navigation for different sections of your documentation, with support for collapsible groups and nested items. The value is an array, each containing a title, a collapsed state, and an array of items. Each item can have a title, link, and optional status (`"new"`, `"updated"`, `"next"`).
236236

237237
:::note
238-
While there are preset statuses available, you can create your own custom status styles.
238+
While there are preset statuses available, you can create your own custom status styles.
239239

240240
```ts title="app.config.ts"
241241
// ..
@@ -293,20 +293,3 @@ sidebar: {
293293
},
294294
// ..
295295
```
296-
297-
#### Search
298-
299-
SolidBase includes built-in search functionality. At the moment, it supports [Algolia DocSearch](https://docsearch.algolia.com/). You can configure the search provider and its options using the `search` option within `themeConfig`.
300-
301-
```ts title="app.config.ts"
302-
// ..
303-
search: {
304-
provider: "algolia",
305-
options: {
306-
appID: "<YOUR_APP_ID>",
307-
apiKey: "<YOUR_API_KEY>"
308-
indexName: "<YOUR_INDEX_NAME>"
309-
}
310-
}
311-
// ..
312-
```
File renamed without changes.

docs/src/routes/guide/(customization)/custom-themes.mdx renamed to docs/src/routes/guide/customization/custom-themes.mdx

File renamed without changes.

docs/src/routes/guide/(customization)/extending-themes.mdx renamed to docs/src/routes/guide/customization/extending-themes.mdx

File renamed without changes.

docs/src/routes/guide/dave.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: What are we missing?
3+
excludeFromSidebar: true
34
---
45

56
# Day 1088 of asking for an internal shitpost channel
File renamed without changes.

0 commit comments

Comments
 (0)