mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-07 21:32:38 +02:00
feat(v2): docs version banner configuration option (#5052)
* refactor DocVersionBanner => versionMetadata prop should be forwarded instead of using "useActiveVersion" + global data * docs version banner configuration * add doc for versions.banner * fix tests * improve docs plugin option api doc
This commit is contained in:
parent
f47826297c
commit
364051f232
13 changed files with 187 additions and 83 deletions
|
@ -8,6 +8,8 @@
|
|||
/* eslint-disable camelcase */
|
||||
|
||||
declare module '@docusaurus/plugin-content-docs-types' {
|
||||
import type {VersionBanner} from './types';
|
||||
|
||||
export type PermalinkToSidebar = {
|
||||
[permalink: string]: string;
|
||||
};
|
||||
|
@ -16,6 +18,7 @@ declare module '@docusaurus/plugin-content-docs-types' {
|
|||
pluginId: string;
|
||||
version: string;
|
||||
label: string;
|
||||
banner: VersionBanner;
|
||||
isLast: boolean;
|
||||
docsSidebars: PropSidebars;
|
||||
permalinkToSidebar: PermalinkToSidebar;
|
||||
|
@ -83,6 +86,7 @@ declare module '@theme/DocItem' {
|
|||
|
||||
export type Props = {
|
||||
readonly route: DocumentRoute;
|
||||
readonly versionMetadata: PropVersionMetadata;
|
||||
readonly content: {
|
||||
readonly frontMatter: FrontMatter;
|
||||
readonly metadata: Metadata;
|
||||
|
@ -96,6 +100,17 @@ declare module '@theme/DocItem' {
|
|||
export default DocItem;
|
||||
}
|
||||
|
||||
declare module '@theme/DocVersionBanner' {
|
||||
import type {PropVersionMetadata} from '@docusaurus/plugin-content-docs-types';
|
||||
|
||||
export type Props = {
|
||||
readonly versionMetadata: PropVersionMetadata;
|
||||
};
|
||||
|
||||
const DocVersionBanner: (props: Props) => JSX.Element;
|
||||
export default DocVersionBanner;
|
||||
}
|
||||
|
||||
declare module '@theme/DocPage' {
|
||||
import type {PropVersionMetadata} from '@docusaurus/plugin-content-docs-types';
|
||||
import type {DocumentRoute} from '@theme/DocItem';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue