Add version header link and change current docs to be version 'next'

This commit is contained in:
Frank Li 2017-08-04 12:41:13 -07:00
parent 9eb6ff2034
commit 63043c041a
6 changed files with 92 additions and 15 deletions

View file

@ -7,11 +7,20 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
const React = require("react");
const CWD = process.cwd();
const siteConfig = require(process.cwd() + "/siteConfig.js");
const React = require("react");
const fs = require("fs");
const siteConfig = require(CWD + "/siteConfig.js");
const translation = require("../../server/translation.js");
const ENABLE_TRANSLATION = fs.existsSync(CWD + "/languages.js");
const ENABLE_VERSIONING = fs.existsSync(CWD + "/versions.json");
let versions;
if (ENABLE_VERSIONING) {
versions = require(CWD + "/versions.json");
}
class LanguageDropDown extends React.Component {
render() {
const enabledLanguages = [];
@ -135,6 +144,11 @@ class HeaderNav extends React.Component {
}
render() {
const versionsLink =
this.props.baseUrl +
(ENABLE_TRANSLATION
? this.props.language + "/versions.html"
: "versions.html");
return (
<div className="fixedHeaderContainer">
<div className="headerWrapper wrapper">
@ -146,6 +160,12 @@ class HeaderNav extends React.Component {
{this.props.title}
</h2>}
</a>
{ENABLE_VERSIONING &&
<a href={versionsLink}>
<h3>
{this.props.version || versions[0]}
</h3>
</a>}
{this.renderResponsiveNav()}
</header>
</div>