Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit bb18ee6

Browse files
committed
Update examples
1 parent bec9ae9 commit bb18ee6

File tree

7 files changed

+23
-38
lines changed

7 files changed

+23
-38
lines changed

examples/feature-apps/monaco-editor/routes/index.tsx renamed to examples/feature-apps/monaco-editor/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import { useEffect, useRef, useState } from "react";
22

3-
export default function Index() {
3+
export default function App() {
44
const [ready, setReady] = useState(false);
55
const editorContainerRef = useRef<HTMLDivElement>(null);
66

77
useEffect(() => {
88
(async () => {
9-
const { createEditor, createModel } = await import("../lib/editor.ts");
9+
const { createEditor, createModel } = await import("./editor.ts");
1010
const editor = createEditor(editorContainerRef.current!);
1111
editor.setModel(createModel("mod.ts", `// Aleph.js with Monaco Editor \n\nconsole.log("Hello, world!");\n`));
1212
setReady(true);
1313
})();
1414
}, []);
1515

1616
return (
17-
<div style={{ width: "100vw", height: "100vh" }} ref={editorContainerRef}>
17+
<div className="editor" ref={editorContainerRef}>
1818
{!ready && <p>Loading...</p>}
1919
</div>
2020
);

examples/feature-apps/monaco-editor/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
padding: 50px;
2828
border: 1px solid #eee;
2929
}
30+
#root .editor {
31+
width: 100%;
32+
height: 100%;
33+
}
3034
</style>
3135
</head>
3236

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Router } from "aleph/react";
2-
import { hydrateRoot } from "react-dom/client";
1+
import { createRoot } from "react-dom/client";
2+
import App from "./App.tsx";
33

4-
hydrateRoot(document.querySelector("#root")!, <Router />);
4+
const root = createRoot(document.querySelector("#root")!);
5+
root.render(<App />);
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
import { Router } from "aleph/react";
21
import { serve } from "aleph/server";
3-
import { renderToString } from "react-dom/server";
42

5-
serve({
6-
config: {
7-
routes: "./routes/**/*.tsx",
8-
},
9-
ssr: (ctx) => renderToString(<Router ssrContext={ctx} />),
10-
});
3+
serve({ port: 3000 });

examples/feature-apps/unocss/index.html

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,12 @@
44
<head>
55
<meta charset="UTF-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<link rel="stylesheet" href="https://esm.sh/@unocss/[email protected]/tailwind.css">
78
<style>
8-
* {
9-
margin: 0;
10-
padding: 0;
11-
border: none;
12-
outline: none;
13-
font: inherit;
14-
font-size: 100%;
15-
vertical-align: baseline;
16-
background: transparent;
17-
}
18-
html, body {
19-
height: 100%;
20-
}
21-
body {
22-
font-family: Inter,"Helvetica Neue",Helvetica,Arial,sans-serif;
23-
font-size: 16px;
24-
}
259
#root {
2610
position: relative;
27-
width: 100%;
28-
height: 100%;
29-
}
30-
a {
31-
color: inherit;
11+
width: 100vw;
12+
height: 100vh;
3213
}
3314
</style>
3415
</head>
@@ -38,4 +19,4 @@
3819
<script type="module" src="./main.tsx"></script>
3920
</body>
4021

41-
</html>
22+
</html>

examples/react-app/server.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ import { renderToReadableStream } from "react-dom/server";
55
serve({
66
config: {
77
routes: "./routes/**/*.{tsx,ts}",
8+
unocss: {
9+
// to enable unocss, please add presets:
10+
// presets: [ unoPreset ],
11+
},
812
},
913
ssr: {
10-
suspense: true,
14+
// when set `suspense` to `true`, the router will loading data as suspense
15+
// please check https://alephjs.org/docs/react/router/suspense
16+
suspense: false,
1117
render: (ctx) => renderToReadableStream(<Router ssrContext={ctx} />, ctx),
1218
},
1319
});

0 commit comments

Comments
 (0)