mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 16:47:26 +02:00
refactor(theme-classic): completely migrate package to TypeScript (#5459)
* Migrate Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Migrate prism as well Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Fix Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Fix lock file Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Fix typing Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * refactor a bit CodeBlock * simplify versionBanner typing => use null instead of "none" (apart plugin options for retrocompatibility) * Remove return signatures Signed-off-by: Josh-Cena <sidachen2003@gmail.com> Co-authored-by: slorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
5f003bcabd
commit
78d84006bb
19 changed files with 153 additions and 95 deletions
|
@ -264,10 +264,10 @@ function getDefaultVersionBanner({
|
|||
versionName: string;
|
||||
versionNames: string[];
|
||||
lastVersionName: string;
|
||||
}): VersionBanner {
|
||||
}): VersionBanner | null {
|
||||
// Current version: good, no banner
|
||||
if (versionName === lastVersionName) {
|
||||
return 'none';
|
||||
return null;
|
||||
}
|
||||
// Upcoming versions: unreleased banner
|
||||
else if (
|
||||
|
@ -291,17 +291,16 @@ function getVersionBanner({
|
|||
versionNames: string[];
|
||||
lastVersionName: string;
|
||||
options: Pick<PluginOptions, 'versions'>;
|
||||
}): VersionBanner {
|
||||
const versionOptionBanner = options.versions[versionName]?.banner;
|
||||
|
||||
return (
|
||||
versionOptionBanner ??
|
||||
getDefaultVersionBanner({
|
||||
versionName,
|
||||
versionNames,
|
||||
lastVersionName,
|
||||
})
|
||||
);
|
||||
}): VersionBanner | null {
|
||||
const versionBannerOption = options.versions[versionName]?.banner;
|
||||
if (versionBannerOption) {
|
||||
return versionBannerOption === 'none' ? null : versionBannerOption;
|
||||
}
|
||||
return getDefaultVersionBanner({
|
||||
versionName,
|
||||
versionNames,
|
||||
lastVersionName,
|
||||
});
|
||||
}
|
||||
|
||||
function getVersionBadge({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue