-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(docs): use correct theme for VitePress (#1517)
Relates to #764 Currently our VitePress docs uses the twogo theme which is not correct. It should use the default onyx theme. This is fixed in this PR. Also the Storybook theme switch now uses dynamic imports for the theme CSS styles
- Loading branch information
1 parent
6b2a884
commit d4d35c9
Showing
3 changed files
with
52 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { defineLoader } from "vitepress"; | ||
|
||
export type Data = { | ||
/** | ||
* List of available onyx themes. Default theme will be sorted first. | ||
*/ | ||
themes: string[]; | ||
}; | ||
|
||
declare const data: Data; | ||
export { data }; | ||
|
||
/** | ||
* Build-Time data loader to get a list of available onyx themes. | ||
* @see https://vitepress.dev/guide/data-loading | ||
*/ | ||
export default defineLoader({ | ||
watch: ["../../../../packages/sit-onyx/src/styles/themes/*.css"], | ||
load(watchedFiles): Data { | ||
return { | ||
themes: watchedFiles | ||
.map((filePath) => filePath.split("/").at(-1)!.replace(".css", "")) | ||
.sort((a, b) => { | ||
if (a === "onyx") return -1; | ||
if (b === "onyx") return 1; | ||
return a.localeCompare(b); | ||
}), | ||
}; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters