@@ -100,6 +100,25 @@ let manualTableOfContents = () => {
100
100
categories
101
101
}
102
102
103
+ let reactTableOfContents = () => {
104
+ let groups =
105
+ allMdx
106
+ -> filterMdxPages ("docs/react" )
107
+ -> groupBySection
108
+ -> Dict .mapValues (values => values -> sortSection -> convertToNavItems )
109
+
110
+ // Console.log(groups)
111
+
112
+ // these are the categories that appear in the sidebar
113
+ let categories : array <SidebarLayout .Sidebar .Category .t > = [
114
+ {name : "Overview" , items : groups -> Dict .getUnsafe ("Overview" )},
115
+ ]
116
+
117
+ Console .log (categories )
118
+
119
+ categories
120
+ }
121
+
103
122
let apiTableOfContents = () => {
104
123
let groups =
105
124
allMdx
@@ -139,10 +158,13 @@ let loader: Loader.t<loaderData> = async ({request}) => {
139
158
let categories = {
140
159
if pathname -> String .includes ("docs/manual/api" ) {
141
160
Console .log (apiTableOfContents ())
142
- []
161
+ apiTableOfContents ()
143
162
} else if pathname -> String .includes ("docs/manual" ) {
144
163
manualTableOfContents ()
164
+ } else if pathname -> String .includes ("docs/react" ) {
165
+ reactTableOfContents ()
145
166
} else {
167
+ // TODO RR7 add react docs
146
168
[]
147
169
}
148
170
}
@@ -194,18 +216,21 @@ let default = () => {
194
216
(pathname :> string )-> String .includes ("docs/manual" )
195
217
? "ReScript Language Manual"
196
218
: "Some other page"
197
-
198
- if (
199
- (pathname :> string )-> String .includes ("docs/manual" ) ||
200
- (pathname :> string )-> String .includes ("docs/react" )
201
- ) {
202
- <DocsLayout metaTitleCategory categories activeToc = {title : "Introduction" , entries }>
203
- <div className = "markdown-body" > {component ()} </div >
204
- </DocsLayout >
205
- } else {
206
- // TODO Handle blog pages
207
- React .null
208
- }
219
+ <>
220
+ <title > {React .string (attributes .metaTitle -> Option .getOr (attributes .title ))} </title >
221
+ <meta name = "description" content = {attributes .description -> Option .getOr ("" )} />
222
+ {if (
223
+ (pathname :> string )-> String .includes ("docs/manual" ) ||
224
+ (pathname :> string )-> String .includes ("docs/react" )
225
+ ) {
226
+ <DocsLayout metaTitleCategory categories activeToc = {title : "Introduction" , entries }>
227
+ <div className = "markdown-body" > {component ()} </div >
228
+ </DocsLayout >
229
+ } else {
230
+ // TODO Handle blog pages
231
+ React .null
232
+ }}
233
+ </>
209
234
210
235
// </ManualDocsLayout.V1200Layout>
211
236
}
0 commit comments