1
- let version = "v8.0.0" ;
2
-
1
+ open Util . ReactStuff ;
3
2
module Link = Next . Link ;
4
3
5
4
// Structure defined by `scripts/extract-tocs.js`
@@ -14,7 +13,7 @@ let tocData:
14
13
"href": string ,
15
14
}),
16
15
}) = [% raw
17
- "require('../index_data/manual_toc .json')"
16
+ "require('../index_data/manual_v800_toc .json')"
18
17
];
19
18
20
19
module UrlPath = DocsLayout . UrlPath ;
@@ -24,7 +23,10 @@ module Toc = DocsLayout.Toc;
24
23
25
24
let overviewNavs = [|
26
25
NavItem . {name: "Introduction" , href: "/docs/manual/v8.0.0/introduction" },
27
- {name: "Migrate to New Syntax" , href: "/docs/manual/v8.0.0/migrate-to-new-syntax" },
26
+ {
27
+ name: "Migrate to New Syntax" ,
28
+ href: "/docs/manual/v8.0.0/migrate-to-new-syntax" ,
29
+ },
28
30
{name: "Installation" , href: "/docs/manual/v8.0.0/installation" },
29
31
{name: "Try" , href: "/docs/manual/v8.0.0/try" },
30
32
{name: "Editor Plugins" , href: "/docs/manual/v8.0.0/editor-plugins" },
@@ -47,7 +49,10 @@ let basicNavs = [|
47
49
{name: "Function" , href: "/docs/manual/v8.0.0/function" },
48
50
{name: "Control Flow" , href: "/docs/manual/v8.0.0/control-flow" },
49
51
{name: "Pipe" , href: "/docs/manual/v8.0.0/pipe" },
50
- {name: "Pattern Matching/Destructuring" , href: "/docs/manual/v8.0.0/pattern-matching-destructuring" },
52
+ {
53
+ name: "Pattern Matching/Destructuring" ,
54
+ href: "/docs/manual/v8.0.0/pattern-matching-destructuring" ,
55
+ },
51
56
{name: "Mutation" , href: "/docs/manual/v8.0.0/mutation" },
52
57
{name: "JSX" , href: "/docs/manual/v8.0.0/jsx" },
53
58
{name: "External" , href: "/docs/manual/v8.0.0/external" },
@@ -60,22 +65,13 @@ let basicNavs = [|
60
65
|] ;
61
66
62
67
let buildsystemNavs = [|
63
- NavItem . {
64
- name: "Overview" ,
65
- href: "/docs/manual/v8.0.0/build-overview" ,
66
- },
67
- {
68
- name: "Configuration" ,
69
- href: "/docs/manual/v8.0.0/build-configuration" ,
70
- },
68
+ NavItem . {name: "Overview" , href: "/docs/manual/v8.0.0/build-overview" },
69
+ {name: "Configuration" , href: "/docs/manual/v8.0.0/build-configuration" },
71
70
{
72
71
name: "Interop with JS Build System" ,
73
72
href: "/docs/manual/v8.0.0/interop-with-js-build-systems" ,
74
73
},
75
- {
76
- name: "Performance" ,
77
- href: "/docs/manual/v8.0.0/build-performance" ,
78
- },
74
+ {name: "Performance" , href: "/docs/manual/v8.0.0/build-performance" },
79
75
|] ;
80
76
81
77
let jsInteropNavs = [|
@@ -85,12 +81,27 @@ let jsInteropNavs = [|
85
81
},
86
82
{name: "Shared Data Types" , href: "/docs/manual/v8.0.0/shared-data-types" },
87
83
{name: "Bind to JS Object" , href: "/docs/manual/v8.0.0/bind-to-js-object" },
88
- {name: "Bind to JS Function" , href: "/docs/manual/v8.0.0/bind-to-js-function" },
89
- {name: "Import from/Export to JS" , href: "/docs/manual/v8.0.0/import-from-export-to-js" },
90
- {name: "Bind to Global JS Values" , href: "/docs/manual/v8.0.0/bind-to-global-js-values" },
84
+ {
85
+ name: "Bind to JS Function" ,
86
+ href: "/docs/manual/v8.0.0/bind-to-js-function" ,
87
+ },
88
+ {
89
+ name: "Import from/Export to JS" ,
90
+ href: "/docs/manual/v8.0.0/import-from-export-to-js" ,
91
+ },
92
+ {
93
+ name: "Bind to Global JS Values" ,
94
+ href: "/docs/manual/v8.0.0/bind-to-global-js-values" ,
95
+ },
91
96
{name: "JSON" , href: "/docs/manual/v8.0.0/json" },
92
- {name: "Browser Support & Polyfills" , href: "/docs/manual/v8.0.0/browser-support-polyfills" },
93
- {name: "Interop Cheatsheet" , href: "/docs/manual/v8.0.0/interop-cheatsheet" },
97
+ {
98
+ name: "Browser Support & Polyfills" ,
99
+ href: "/docs/manual/v8.0.0/browser-support-polyfills" ,
100
+ },
101
+ {
102
+ name: "Interop Cheatsheet" ,
103
+ href: "/docs/manual/v8.0.0/interop-cheatsheet" ,
104
+ },
94
105
|] ;
95
106
96
107
let guidesNavs = [|
@@ -102,7 +113,10 @@ let guidesNavs = [|
102
113
|] ;
103
114
104
115
let extraNavs = [|
105
- NavItem . {name: "Newcomer Examples" , href: "/docs/manual/v8.0.0/newcomer-examples" },
116
+ NavItem . {
117
+ name: "Newcomer Examples" ,
118
+ href: "/docs/manual/v8.0.0/newcomer-examples" ,
119
+ },
106
120
{name: "Project Structure" , href: "/docs/manual/v8.0.0/project-structure" },
107
121
{name: "FAQ" , href: "/docs/manual/v8.0.0/faq" },
108
122
|] ;
@@ -118,7 +132,12 @@ let categories = [|
118
132
119
133
module Docs = {
120
134
[@ react . component ]
121
- let make = (~frontmatter: option (Js . Json . t )=?, ~components= Markdown . default, ~children) => {
135
+ let make =
136
+ (
137
+ ~frontmatter: option (Js . Json . t )=?,
138
+ ~components= Markdown . default,
139
+ ~children,
140
+ ) => {
122
141
let router = Next . Router . useRouter() ;
123
142
let route = router. route;
124
143
@@ -155,16 +174,44 @@ module Docs = {
155
174
);
156
175
157
176
let title = "Language Manual" ;
177
+ let version = "v8.0.0" ;
178
+
179
+ let url = Url . parse(route);
180
+ let latestUrl =
181
+ "/"
182
+ ++ Js . Array2 . joinWith(url. base, "/" )
183
+ ++ "/latest/"
184
+ ++ Js . Array2 . joinWith(url. pagepath, "/" );
185
+
186
+ let warnBanner =
187
+ Markdown . (
188
+ <div className= "mb-10" >
189
+ <Info >
190
+ <P >
191
+ {(
192
+ "You are currently looking at the "
193
+ ++ version
194
+ ++ " docs. You can find the latest manual page "
195
+ )
196
+ -> s}
197
+ <A href= latestUrl> "here" -> s </A >
198
+ "." -> s
199
+ </P >
200
+ </Info >
201
+ </div >
202
+ );
158
203
159
204
<DocsLayout
160
205
theme= ` Reason
161
206
components
162
207
categories
163
208
version
209
+ availableVersions= ManualDocsLayout . allManualVersions
164
210
?frontmatter
165
211
title
166
212
?activeToc
167
213
?breadcrumbs>
214
+ warnBanner
168
215
children
169
216
</DocsLayout >;
170
217
};
@@ -173,8 +220,6 @@ module Docs = {
173
220
module Prose = {
174
221
[@ react . component ]
175
222
let make = (~frontmatter: option (Js . Json . t )=?, ~children) => {
176
- <Docs ?frontmatter components= Markdown . default>
177
- children
178
- </Docs >;
223
+ <Docs ?frontmatter components= Markdown . default> children </Docs >;
179
224
};
180
225
};
0 commit comments