aboutsummaryrefslogtreecommitdiffstats
path: root/packages/react-docs/src/components/documentation.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/react-docs/src/components/documentation.tsx')
-rw-r--r--packages/react-docs/src/components/documentation.tsx10
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx
index a4e6f4f6e..7030001e8 100644
--- a/packages/react-docs/src/components/documentation.tsx
+++ b/packages/react-docs/src/components/documentation.tsx
@@ -12,6 +12,7 @@ import {
import * as _ from 'lodash';
import CircularProgress from 'material-ui/CircularProgress';
import * as React from 'react';
+import * as semver from 'semver';
import { DocsInfo } from '../docs_info';
import {
@@ -180,7 +181,14 @@ export class Documentation extends React.Component<DocumentationProps, Documenta
return renderedSections;
}
private _renderSection(typeDefinitionByName: TypeDefinitionByName, sectionName: string): React.ReactNode {
- const markdownFileIfExists = this.props.docsInfo.sectionNameToMarkdown[sectionName];
+ const markdownVersions = _.keys(this.props.docsInfo.sectionNameToMarkdownByVersion);
+ // Get version LTE to selectedVersion
+ const eligibleVersions = _.filter(markdownVersions, mdVersion => {
+ return semver.lte(mdVersion, this.props.selectedVersion);
+ });
+ const sortedEligibleVersions = eligibleVersions.sort(semver.rcompare.bind(semver));
+ const closestVersion = sortedEligibleVersions[0];
+ const markdownFileIfExists = this.props.docsInfo.sectionNameToMarkdownByVersion[closestVersion][sectionName];
if (!_.isUndefined(markdownFileIfExists)) {
return (
<MarkdownSection