~repos /edge-city
git clone https://pyrossh.dev/repos/edge-city.git
edge-city is a next level meta-framework for react that runs only on edge runtimes
4ccdf6f5
—
pyrossh 2 years ago
get todos streaming ssr working
example/src/pages/page.jsx
CHANGED
|
@@ -16,7 +16,7 @@ const Page = () => {
|
|
|
16
16
|
<title>Edge City</title>
|
|
17
17
|
</Helmet>
|
|
18
18
|
<div className="home-page">
|
|
19
|
-
<h1>Home Page
|
|
19
|
+
<h1>Home Page</h1>
|
|
20
20
|
<p>
|
|
21
21
|
Path: {router.pathname}
|
|
22
22
|
</p>
|
example/src/{static → pages}/todos/page.css
RENAMED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
body {
|
|
2
|
-
padding: 10px;
|
|
3
|
-
background-color: turquoise;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
1
|
:root {
|
|
8
2
|
--spectrum-alias-border-color: black;
|
|
9
3
|
--spectrum-global-color-gray-50: white;
|
|
10
4
|
}
|
|
11
5
|
|
|
12
|
-
|
|
13
6
|
.react-aria-TextField {
|
|
14
7
|
--field-border: var(--spectrum-alias-border-color);
|
|
15
8
|
--field-border-disabled: var(--spectrum-alias-border-color-disabled);
|
example/src/{static → pages}/todos/page.jsx
RENAMED
|
@@ -2,13 +2,31 @@ import React, { Suspense } from 'react';
|
|
|
2
2
|
import { Helmet } from 'react-helmet-async';
|
|
3
3
|
import { useQuery, useMutation } from "edge-city";
|
|
4
4
|
import { useForm } from 'react-hook-form';
|
|
5
|
+
import Layout from '@/components/Layout/Layout';
|
|
5
6
|
import Todo from "@/components/Todo/Todo";
|
|
6
7
|
import { TextField, Label, Input } from 'react-aria-components';
|
|
7
8
|
import { Button } from 'react-aria-components';
|
|
8
9
|
import { getTodos, createTodo } from "@/services/todos.service";
|
|
9
|
-
import Layout from '@/components/Layout/Layout';
|
|
10
10
|
import "./page.css";
|
|
11
11
|
|
|
12
|
+
const Page = () => {
|
|
13
|
+
return (
|
|
14
|
+
<Layout>
|
|
15
|
+
<h1>Todos</h1>
|
|
16
|
+
<Helmet>
|
|
17
|
+
<title>Todos Page</title>
|
|
18
|
+
</Helmet>
|
|
19
|
+
<div>
|
|
20
|
+
<Suspense fallback="Loading...">
|
|
21
|
+
<TodoList />
|
|
22
|
+
</Suspense>
|
|
23
|
+
</div>
|
|
24
|
+
</Layout>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default Page;
|
|
29
|
+
|
|
12
30
|
const TodoList = () => {
|
|
13
31
|
const { data, refetch } = useQuery("todos", () => getTodos());
|
|
14
32
|
const { mutate, isMutating, err } = useMutation(async ({ text }) => {
|
|
@@ -40,22 +58,4 @@ const TodoList = () => {
|
|
|
40
58
|
</form>
|
|
41
59
|
</div>
|
|
42
60
|
)
|
|
43
|
-
}
|
|
61
|
+
}
|
|
44
|
-
|
|
45
|
-
const Page = () => {
|
|
46
|
-
return (
|
|
47
|
-
<Layout>
|
|
48
|
-
<h1>Todos</h1>
|
|
49
|
-
<Helmet>
|
|
50
|
-
<title>Todos Page</title>
|
|
51
|
-
</Helmet>
|
|
52
|
-
<div>
|
|
53
|
-
<Suspense fallback="Loading...">
|
|
54
|
-
<TodoList />
|
|
55
|
-
</Suspense>
|
|
56
|
-
</div>
|
|
57
|
-
</Layout>
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export default Page;
|