From 82c751f092ad3b6eece3e2ddbb2c0fd80db97a4a Mon Sep 17 00:00:00 2001 From: Alexey Pyltsyn Date: Mon, 25 Nov 2019 12:16:23 +0300 Subject: [PATCH] fix(v2): hide past versions if it does not exist (#2050) --- website/src/pages/versions.js | 57 ++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/website/src/pages/versions.js b/website/src/pages/versions.js index 27531b958a..801c618654 100644 --- a/website/src/pages/versions.js +++ b/website/src/pages/versions.js @@ -19,6 +19,7 @@ function Version() { const context = useDocusaurusContext(); const {siteConfig = {}} = context; const latestVersion = versions[0]; + const pastVersions = versions.filter(version => version !== latestVersion); const repoUrl = `https://github.com/${siteConfig.organizationName}/${siteConfig.projectName}`; return ( -
-

Past Versions

-

- Here you can find documentation for previous versions of Docusaurus. -

- - - {versions.map( - version => - version !== latestVersion && ( - - - - - - ), - )} - -
{version} - - Documentation - - - - Release Notes - -
-
+ {pastVersions.length > 0 && ( +
+

Past Versions

+

+ Here you can find documentation for previous versions of + Docusaurus. +

+ + + {pastVersions.map(version => ( + + + + + + ))} + +
{version} + + Documentation + + + + Release Notes + +
+
+ )}
);