-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
63 lines (58 loc) · 1.85 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Coy.js TodoApp example</title>
</head>
<body>
<div id="app"></div>
<script src="https://cdn.tailwindcss.com"></script>
<script src="/utils.js"></script>
<script src="/signal.js"></script>
<script src="/baseComponent.js"></script>
<script src="/createElement.js"></script>
<script src="/components.js"></script>
<script src="/toast.js"></script>
<script src="/coy-route.js"></script>
<script src="/pages/TodoPage.js"></script>
<script src="/pages/NotFound.js"></script>
<script src="/bootstrap.js"></script>
<script>
const Home = () => {
const [random, setRandom] = signal(Math.random().toString(36));
return Fragment(
Div(
props({
className: "fixed flex justify-center gap-4 p-4 text-lg",
}),
CoyLink("Home", props({ href: "/" })),
CoyLink("TodoApp", props({ href: "/todo" })),
CoyLink(
"NotFound",
props({
href: random,
onclick: () => setRandom(Math.random().toString(36)),
})
)
),
RoutesProvider([
{
path: "/",
component: ({ outlet }) =>
Div(props({ id: "qualquer" }), "Textoqualquer", outlet),
children: [{ path: "/", component: TodoApp }],
},
{
path: "todo",
component: ({ outlet }) =>
Div(props({ id: "qualquer" }), "outrotextoqualquer", outlet),
children: [{ path: "/", component: TodoApp }],
},
])
);
};
bootstrap(app, Home);
</script>
</body>
</html>