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