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:
Sébastien Lorber 2021-06-24 18:04:16 +02:00 committed by GitHub
parent f47826297c
commit 364051f232
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 187 additions and 83 deletions

View file

@ -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';