Skip to content

Commit d905350

Browse files
committed
Fixup website sidebar links & switch md used for node_modules/reason-react-native instead local folder
Due to monorepo being exploded
1 parent 5ec6d2c commit d905350

File tree

4 files changed

+52
-60
lines changed

4 files changed

+52
-60
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"reason-future": "^2.4.0",
4343
"reason-highlightjs": "^0.2.0",
4444
"reason-react": "^0.7.0",
45-
"reason-react-native": "^0.60.1",
45+
"reason-react-native": "https://github.com/reason-react-native/reason-react-native.git#bd0b3b1",
4646
"static-server-cli": "^1.0.2",
4747
"trash-cli": "^1.4.0"
4848
}

scripts/PrepareMdToJson.re

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ Path.join([|sourcePath, "**/*.md"|])
6969
});
7070

7171
Js.log("Modules...");
72-
let sourcePath = Path.join([|root, "..", "reason-react-native", "src"|]);
72+
let sourcePath =
73+
Path.join([|root, "node_modules", "reason-react-native", "src"|]);
7374
let outputPath = Path.join([|root, "build", "docs-src"|]);
7475
Path.join([|sourcePath, "**/*.md"|])
7576
->FsUtils.transform(files => {
@@ -205,4 +206,4 @@ Path.join([|sourcePath, "**/*.md"|])
205206
(index^ |> Js.Json.stringifyAny)->Option.getWithDefault("[]"),
206207
},
207208
|]);
208-
});
209+
});

src/components/SidebarDocs.re

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -113,51 +113,51 @@ let make = (~docsIndex, ~currentLocation) => {
113113
</Text>
114114
</SpacedView>
115115
</div>
116-
{{section.data
117-
->List.map(((title, link)) => {
118-
let fulllink = "en/" ++ link;
119-
let isActive =
120-
currentLocation##pathname
121-
|> Js.String.startsWith(fulllink ++ "index.html");
122-
!(link |> Js.String.startsWith("docs/apis/"))
123-
&& !(link |> Js.String.startsWith("docs/components/"))
124-
|| (
125-
link
126-
|> Js.String.startsWith("docs/apis/")
127-
|| link
128-
|> Js.String.startsWith("docs/components/")
129-
)
130-
&& docsIndex->Array.some(path =>
131-
link == "docs/" ++ path ++ "/"
132-
)
133-
? <ViewLink
134-
key=title
135-
href={Consts.baseUrl ++ "/" ++ fulllink}
136-
style={Style.arrayOption([|
137-
Some(styles##link),
138-
isActive ? Some(styles##linkActive) : None,
139-
|])}>
140-
<SpacedView horizontal=XS vertical=XXS>
141-
<Text
142-
style={Style.arrayOption([|
143-
Some(styles##linkText),
144-
isActive ? Some(styles##linkTextActive) : None,
145-
|])}>
146-
title->React.string
147-
</Text>
148-
</SpacedView>
149-
</ViewLink>
150-
: <SpacedView horizontal=XS vertical=XXS>
151-
<Text
152-
key=title
153-
style={Style.array([|
154-
styles##link,
155-
styles##notlinkText,
156-
|])}>
157-
title->React.string
158-
</Text>
159-
</SpacedView>;
160-
})}
116+
{{
117+
section.data
118+
->List.map(((title, link)) => {
119+
let fulllink = "en/" ++ link;
120+
let isActive =
121+
currentLocation##pathname
122+
|> Js.String.startsWith(fulllink ++ "index.html");
123+
let isApi = link |> Js.String.startsWith("docs/apis/");
124+
let isComponent =
125+
link |> Js.String.startsWith("docs/components/");
126+
!isApi
127+
&& !isComponent
128+
|| (isApi || isComponent)
129+
&& docsIndex->Array.some(path =>
130+
link == "docs/" ++ path ++ "/"
131+
)
132+
? <ViewLink
133+
key=title
134+
href={Consts.baseUrl ++ "/" ++ fulllink}
135+
style={Style.arrayOption([|
136+
Some(styles##link),
137+
isActive ? Some(styles##linkActive) : None,
138+
|])}>
139+
<SpacedView horizontal=XS vertical=XXS>
140+
<Text
141+
style={Style.arrayOption([|
142+
Some(styles##linkText),
143+
isActive ? Some(styles##linkTextActive) : None,
144+
|])}>
145+
title->React.string
146+
</Text>
147+
</SpacedView>
148+
</ViewLink>
149+
: <SpacedView horizontal=XS vertical=XXS>
150+
<Text
151+
key=title
152+
style={Style.array([|
153+
styles##link,
154+
styles##notlinkText,
155+
|])}>
156+
title->React.string
157+
</Text>
158+
</SpacedView>;
159+
});
160+
}
161161
->List.toArray
162162
->React.array}
163163
<Spacer size=Spacer.S />

yarn.lock

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,14 +2081,6 @@ readable-stream@^2.0.0, readable-stream@^2.0.2, readable-stream@^2.0.5, readable
20812081
version "2.3.6"
20822082
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf"
20832083
integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==
2084-
dependencies:
2085-
core-util-is "~1.0.0"
2086-
inherits "~2.0.3"
2087-
isarray "~1.0.0"
2088-
process-nextick-args "~2.0.0"
2089-
safe-buffer "~5.1.1"
2090-
string_decoder "~1.1.1"
2091-
util-deprecate "~1.0.1"
20922084

20932085
readable-stream@~1.0.31:
20942086
version "1.0.34"
@@ -2110,10 +2102,9 @@ reason-highlightjs@^0.2.0:
21102102
resolved "https://registry.yarnpkg.com/reason-highlightjs/-/reason-highlightjs-0.2.0.tgz#275583ef73ec79d8bfd1d9940431162094d196c2"
21112103
integrity sha512-6tidPU8nKpwAkPm3Tf7BDjKzfYmHXn0iR1hG+Dzu/3uuadcphpcJspjrs54GWIfx3fevNmWGhsyGW60zUxHkmg==
21122104

2113-
reason-react-native@^0.60.1:
2114-
version "0.60.1"
2115-
resolved "https://registry.yarnpkg.com/reason-react-native/-/reason-react-native-0.60.1.tgz#eb60dbed6a85ffc4805c08ab4d6a0b551c132c7f"
2116-
integrity sha512-XJJqG62LW9j7YstzAsD20S8t1kH3uVu19/PT5NByceCACq/8oClBLsFXHXhlPvVvdgKvydGjQo+mNb+JCoJ2Kw==
2105+
"reason-react-native@https://github.com/reason-react-native/reason-react-native.git#bd0b3b1":
2106+
version "0.61.1"
2107+
resolved "https://github.com/reason-react-native/reason-react-native.git#bd0b3b1708076d0de39c669e2a1f89836cfd9ed3"
21172108

21182109
reason-react@^0.7.0:
21192110
version "0.7.0"

0 commit comments

Comments
 (0)