Skip to content

Commit e9ce5cb

Browse files
committed
all app folder is all rescript
1 parent a922ad7 commit e9ce5cb

File tree

14 files changed

+141
-99
lines changed

14 files changed

+141
-99
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@ public/_redirects
4141

4242
dist
4343
build
44-
.react-router
44+
.react-router
45+
46+
app/**/*.mjs

app/root.jsx

Lines changed: 0 additions & 45 deletions
This file was deleted.

app/root.res

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
%%raw(`
2+
import "../styles/_hljs.css";
3+
import "../styles/main.css";
4+
import "../styles/utils.css";
5+
6+
import hljs from 'highlight.js/lib/core';
7+
import bash from 'highlight.js/lib/languages/bash';
8+
import css from 'highlight.js/lib/languages/css';
9+
import diff from 'highlight.js/lib/languages/diff';
10+
import javascript from 'highlight.js/lib/languages/javascript';
11+
import json from 'highlight.js/lib/languages/json';
12+
import text from 'highlight.js/lib/languages/plaintext';
13+
import html from 'highlight.js/lib/languages/xml';
14+
import rescript from 'highlightjs-rescript';
15+
16+
hljs.registerLanguage('rescript', rescript)
17+
hljs.registerLanguage('javascript', javascript)
18+
hljs.registerLanguage('css', css)
19+
hljs.registerLanguage('ts', javascript)
20+
hljs.registerLanguage('sh', bash)
21+
hljs.registerLanguage('json', json)
22+
hljs.registerLanguage('text', text)
23+
hljs.registerLanguage('html', html)
24+
hljs.registerLanguage('diff', diff)
25+
`)
26+
27+
open ReactRouter
28+
29+
@react.component
30+
let default = () => {
31+
let (isOverlayOpen, setOverlayOpen) = React.useState(_ => false)
32+
<html>
33+
<head>
34+
<link rel="icon" href="data:image/x-icon;base64,AA" />
35+
</head>
36+
<body>
37+
<Navigation isOverlayOpen setOverlayOpen />
38+
<Outlet />
39+
<Scripts />
40+
</body>
41+
</html>
42+
}

app/routes.mjs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
import { index, route } from "@react-router/dev/routes";
2-
import { routes } from 'react-router-mdx/server';
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
32

4-
export default [
5-
index("./routes/LandingPageRoute.jsx"),
6-
route("syntax-lookup", "./routes/SyntaxLookupRoute.jsx"),
7-
...routes("./routes/mdx.jsx"),
8-
// TODO: playground, blog, community,
9-
]
3+
import * as Belt_Array from "rescript/lib/es6/Belt_Array.js";
4+
import * as Server from "react-router-mdx/server";
5+
import * as Routes from "@react-router/dev/routes";
6+
7+
let $$default = Belt_Array.concatMany([
8+
[
9+
Routes.index("./routes/LandingPageRoute.mjs"),
10+
Routes.route("syntax-lookup", "./routes/SyntaxLookupRoute.mjs")
11+
],
12+
Server.routes("./routes/MdxRoute.mjs")
13+
]);
14+
15+
export {
16+
$$default as default,
17+
}
18+
/* default Not a pure module */

app/routes.res

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
open ReactRouter.Routes
2+
open ReactRouter.Mdx
3+
4+
let default = [
5+
index("./routes/LandingPageRoute.mjs"),
6+
route("syntax-lookup", "./routes/SyntaxLookupRoute.mjs"),
7+
...routes("./routes/MdxRoute.mjs"),
8+
] // TODO: playground, blog, community,

app/routes/$.jsx

Lines changed: 0 additions & 13 deletions
This file was deleted.

app/routes/LandingPageRoute.jsx

Lines changed: 0 additions & 6 deletions
This file was deleted.

app/routes/LandingPageRoute.res

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
let default = () => {
2+
<LandingPageLayout>
3+
<div></div>
4+
</LandingPageLayout>
5+
}

app/routes/MdxRoute.res

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
open ReactRouter
2+
open Mdx
3+
4+
type loaderData = Mdx.t
5+
6+
let loader: Loader.t<loaderData> = async ({request}) => {
7+
let res = await loadMdx(request)
8+
res
9+
}
10+
11+
let default = () => {
12+
let component = useMdxComponent()
13+
let attributes = useMdxAttributes()
14+
<section>
15+
<h1> {React.string(attributes.title)} </h1>
16+
{component()}
17+
</section>
18+
}

app/routes/SyntaxLookupRoute.jsx

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)