Skip to content

Commit 86255ff

Browse files
authored
Restructure docs (#1010)
* Restructure docs * remove js from api overview * update api sidebar * group at the top * remove another link to JS * reorg api sidebar * fix new dead code guide title * empty * change is active link
1 parent a5825c8 commit 86255ff

File tree

5 files changed

+56
-74
lines changed

5 files changed

+56
-74
lines changed

data/sidebar_manual_v1200.json

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,32 @@
22
"Overview": [
33
"introduction",
44
"installation",
5-
"migrate-to-v11",
65
"editor-plugins",
7-
"try"
6+
"faq",
7+
"llms"
8+
],
9+
"Guides": [
10+
"converting-from-js",
11+
"editor-code-analysis",
12+
"newcomer-examples",
13+
"project-structure"
14+
],
15+
"JavaScript Interop": [
16+
"interop-cheatsheet",
17+
"embed-raw-javascript",
18+
"shared-data-types",
19+
"external",
20+
"bind-to-js-object",
21+
"bind-to-js-function",
22+
"import-from-export-to-js",
23+
"bind-to-global-js-values",
24+
"json",
25+
"inlining-constants",
26+
"use-illegal-identifier-names",
27+
"generate-converters-accessors",
28+
"browser-support-polyfills",
29+
"libraries",
30+
"typescript-integration"
831
],
932
"Language Features": [
1033
"overview",
@@ -35,27 +58,6 @@
3558
"reserved-keywords",
3659
"equality-comparison"
3760
],
38-
"Advanced Features": [
39-
"extensible-variant",
40-
"scoped-polymorphic-types"
41-
],
42-
"JavaScript Interop": [
43-
"interop-cheatsheet",
44-
"embed-raw-javascript",
45-
"shared-data-types",
46-
"external",
47-
"bind-to-js-object",
48-
"bind-to-js-function",
49-
"import-from-export-to-js",
50-
"bind-to-global-js-values",
51-
"json",
52-
"inlining-constants",
53-
"use-illegal-identifier-names",
54-
"generate-converters-accessors",
55-
"browser-support-polyfills",
56-
"libraries",
57-
"typescript-integration"
58-
],
5961
"Build System": [
6062
"build-overview",
6163
"build-configuration",
@@ -66,14 +68,8 @@
6668
"build-performance",
6769
"warning-numbers"
6870
],
69-
"Guides": [
70-
"converting-from-js",
71-
"editor-code-analysis"
72-
],
73-
"Extra": [
74-
"newcomer-examples",
75-
"project-structure",
76-
"faq",
77-
"llms"
71+
"Advanced Features": [
72+
"extensible-variant",
73+
"scoped-polymorphic-types"
7874
]
7975
}

pages/docs/manual/v12.0.0/api.mdx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,5 @@ In ReScript 11, it is shipped as a separate npm package `@rescript/core` that is
1010

1111
ReScript ships with these two additional modules in its standard library:
1212

13-
- [Belt](api/belt): immutable collections and extra helpers not available in JavaScript / [Core](api/core).
14-
- [Dom](api/dom): Dom related types and modules. Contains our standardized types used by various userland DOM bindings.
15-
16-
## Legacy Modules
17-
18-
The [Js](api/js) module is superseded by [Core](api/core).
13+
- [Belt](api/belt): immutable collections and extra helpers not available in [Core](api/core).
14+
- [Dom](api/dom): Dom related types and modules. Contains our standardized types used by various userland DOM bindings.

pages/docs/manual/v12.0.0/editor-code-analysis.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
title: "Editor"
3-
metaTitle: "Editor"
2+
title: "Dead Code Analysis in ReScript"
3+
metaTitle: "Dead Code Analysis in ReScript"
44
description: "Documentation about ReScript editor plugins and code analysis"
55
canonical: "/docs/manual/v12.0.0/editor-plugins"
66
---
77

8-
# Guide: Dead Code Analysis in ReScript
8+
# Dead Code Analysis in ReScript
99

1010
This guide provides a detailed walkthrough on how to leverage ReScript’s powerful dead code analysis tools to maintain a clean, efficient, and distraction-free codebase.
1111

src/components/Navigation.res

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ let linkOrActiveApiSubroute = (~route) => {
1616
}
1717
}
1818

19+
let isActiveLink = (~route: string, ~href: string) => {
20+
route == href ? activeLink : link
21+
}
22+
1923
module CollapsibleLink = {
2024
// KeepOpen = Menu has been opened and should stay open
2125
type state =
@@ -177,27 +181,6 @@ module DocsSection = {
177181
}
178182
},
179183
},
180-
{
181-
imgSrc: "/static/[email protected]",
182-
title: "GenType",
183-
description: "Seamless TypeScript integration",
184-
href: `/docs/manual/${version}/typescript-integration`,
185-
isActive: url => {
186-
switch url.fullpath {
187-
| ["docs", "manual", _, "typescript-integration"] => true
188-
| _ => false
189-
}
190-
},
191-
},
192-
{
193-
imgSrc: "/static/[email protected]",
194-
title: "Reanalyze",
195-
description: "Dead Code & Termination analysis",
196-
href: "https://github.com/rescript-lang/reanalyze",
197-
isActive: _ => {
198-
false
199-
},
200-
},
201184
]
202185

203186
let languageManualColumn =
@@ -532,10 +515,21 @@ let make = (~fixed=true, ~isOverlayOpen: bool, ~setOverlayOpen: (bool => bool) =
532515
<div
533516
className="flex ml-10 space-x-5 w-full max-w-320"
534517
style={ReactDOMStyle.make(~maxWidth="26rem", ())}>
535-
{collapsibleElements->React.array}
536-
<Link href={`/docs/manual/${version}/api`} className={linkOrActiveApiSubroute(~route)}>
518+
<Link
519+
href={`/docs/manual/${version}/introduction`}
520+
className={isActiveLink(~route, ~href=`/docs/manual/${version}/introduction`)}>
521+
{React.string("Docs")}
522+
</Link>
523+
<Link
524+
href={`/docs/manual/${version}/api`}
525+
className={isActiveLink(~route, ~href=`/docs/manual/${version}/api`)}>
537526
{React.string("API")}
538527
</Link>
528+
<Link
529+
href={`/docs/react/latest/introduction`}
530+
className={isActiveLink(~route, ~href=`/docs/react/latest/introduction`)}>
531+
{React.string("React")}
532+
</Link>
539533
<Link
540534
href="/try"
541535
className={"hidden xs:block " ++ linkOrActiveLink(~target="/try", ~route)}>

src/layouts/ApiOverviewLayout.res

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ module Sidebar = SidebarLayout.Sidebar
22

33
let makeCategories: string => array<Sidebar.Category.t> = version => [
44
{
5-
name: "Introduction",
6-
items: [{name: "Overview", href: `/docs/manual/${version}/api`}],
7-
},
8-
{
9-
name: "Standard Library",
10-
items: [{name: "Core", href: `/docs/manual/${version}/api/core`}],
5+
name: "",
6+
items: [
7+
{name: "Overview", href: `/docs/manual/${version}/api`},
8+
{name: "Core", href: `/docs/manual/${version}/api/core`},
9+
{name: "Syntax Lookup", href: "/syntax-lookup"},
10+
],
1111
},
1212
{
1313
name: "Additional Libraries",
@@ -16,10 +16,6 @@ let makeCategories: string => array<Sidebar.Category.t> = version => [
1616
{name: "Dom", href: `/docs/manual/${version}/api/dom`},
1717
],
1818
},
19-
{
20-
name: "Legacy Modules",
21-
items: [{name: "Js", href: `/docs/manual/${version}/api/js`}],
22-
},
2319
]
2420

2521
/* Used for API docs (structured data) */

0 commit comments

Comments
 (0)