mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-17 02:56:57 +02:00
feat(v2): @docusaurus/theme-common (#3775)
* create base @docusaurus/theme-common package + fix Webpack client export aliases issue shadowing other theme-common package * Move theme-classic/src/utils code to new @docusaurus/theme-common package * add prettierignore * fix bad test location for getDocusaurusAliases()
This commit is contained in:
parent
5872bbc735
commit
abcd8cefd6
39 changed files with 176 additions and 32 deletions
31
packages/docusaurus-theme-common/src/utils/useThemeConfig.ts
Normal file
31
packages/docusaurus-theme-common/src/utils/useThemeConfig.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
|
||||
export type DocsVersionPersistence = 'localStorage' | 'none';
|
||||
|
||||
export type ThemeConfig = {
|
||||
docs: {
|
||||
versionPersistence: DocsVersionPersistence;
|
||||
};
|
||||
|
||||
// TODO we should complete this theme config type over time
|
||||
// and share it across all themes
|
||||
// and use it in the Joi validation schema?
|
||||
|
||||
// TODO temporary types
|
||||
navbar: any;
|
||||
colorMode: any;
|
||||
announcementBar: any;
|
||||
prism: any;
|
||||
footer: any;
|
||||
hideableSidebar: any;
|
||||
};
|
||||
|
||||
export function useThemeConfig(): ThemeConfig {
|
||||
return useDocusaurusContext().siteConfig.themeConfig as ThemeConfig;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue