-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
/
versions.js
104 lines (96 loc) · 3.32 KB
/
versions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const React = require('react');
const CompLibrary = require('../../core/CompLibrary');
const Container = CompLibrary.Container;
const CWD = process.cwd();
const siteConfig = require(`${CWD}/siteConfig.js`);
const versions = require(`${CWD}/versions.json`);
const versionToReleaseTags = {
'5.x': '5.0.0',
'6.x': '6.0.0',
'7.x': '7.0.1'
}
function Versions() {
const latestVersion = versions[0];
const repoUrl = `https://github.com/${siteConfig.organizationName}/${
siteConfig.projectName
}`;
const releaseTagUrl = version => versionToReleaseTags.hasOwnProperty(version) ? `${repoUrl}/releases/tag/v${versionToReleaseTags[version]}` : `${repoUrl}/releases/tag/v${version}`
return (
<div className="docMainWrapper wrapper">
<Container className="mainContainer versionsContainer">
<div className="post">
<header className="postHeader">
<h1>{siteConfig.title} Versions</h1>
</header>
<p>New versions of this project are released every so often.</p>
<h3 id="latest">Current version (Stable)</h3>
<table className="versions">
<tbody>
<tr>
<th>{latestVersion}</th>
<td>
<a href="/introduction/quick-start">Documentation</a>
</td>
<td>
<a href={releaseTagUrl(latestVersion)}>Release Notes</a>
</td>
</tr>
</tbody>
</table>
<p>
This is the version that is configured automatically when you first
install this project.
</p>
{
!!siteConfig.nextVersion && (<React.Fragment>
<h3 id="rc">Pre-release versions</h3>
<table className="versions">
<tbody>
<tr>
<th>{siteConfig.nextVersion}</th>
<td>
<a href={`/next/introduction/quick-start`}>Documentation</a>
</td>
<td>
<a href={releaseTagUrl(siteConfig.nextVersion)}>Release Notes</a>
</td>
</tr>
</tbody>
</table>
</React.Fragment>)
}
<h3 id="archive">Past Versions</h3>
<table className="versions">
<tbody>
{versions.map(
version =>
version !== latestVersion && (
<tr key={`version-${version}`}>
<th>{version}</th>
<td>
<a href={`${version}/introduction/quick-start`}>Documentation</a>
</td>
<td>
<a href={releaseTagUrl(version)}>Release Notes</a>
</td>
</tr>
),
)}
</tbody>
</table>
<p>
You can find past versions of this project on{' '}
<a href={repoUrl}>GitHub</a>.
</p>
</div>
</Container>
</div>
);
}
module.exports = Versions;