@batijs/cli 0.0.25 → 0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/boilerplates/@batijs/edgedb/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/edgedb/{package-NAEM3YOJ.js → package-L6QX4DU3.js} +1 -1
- package/dist/boilerplates/@batijs/express/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/express/files/express-entry.ts +124 -124
- package/dist/boilerplates/@batijs/express/{package-VWSKNQQS.js → package-A6VFZMH3.js} +2 -2
- package/dist/boilerplates/@batijs/hattip/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/hattip/files/hattip-entry.ts +88 -88
- package/dist/boilerplates/@batijs/hattip/{package-PAHNC63I.js → package-CWCBXXG7.js} +2 -2
- package/dist/boilerplates/@batijs/prisma/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/prisma/{package-42T5MPMS.js → package-4DL673EC.js} +1 -1
- package/dist/boilerplates/@batijs/react/files/$package.json.js +12 -0
- package/dist/boilerplates/@batijs/react/files/$tsconfig.json.js +12 -0
- package/dist/boilerplates/@batijs/react/files/$vite.config.ts.js +17 -0
- package/dist/boilerplates/@batijs/react/files/assets/logo.svg +36 -0
- package/dist/boilerplates/@batijs/react/files/components/Link.tsx +15 -0
- package/dist/boilerplates/@batijs/react/files/layouts/HeadDefault.tsx +22 -0
- package/dist/boilerplates/@batijs/react/files/layouts/LayoutDefault.tsx +87 -0
- package/dist/boilerplates/@batijs/react/files/layouts/style.css +29 -0
- package/dist/boilerplates/@batijs/react/files/pages/+config.h.ts +18 -0
- package/dist/boilerplates/@batijs/react/files/pages/_error/+Page.tsx +22 -0
- package/dist/boilerplates/@batijs/react/files/pages/index/+Page.tsx +22 -0
- package/dist/boilerplates/@batijs/react/files/pages/index/Counter.tsx +18 -0
- package/dist/boilerplates/@batijs/react/files/pages/star-wars/@id/+Page.tsx +17 -0
- package/dist/boilerplates/@batijs/react/files/pages/star-wars/@id/+onBeforeRender.ts +27 -0
- package/dist/boilerplates/@batijs/react/files/pages/star-wars/filterMovieData.ts +11 -0
- package/dist/boilerplates/@batijs/react/files/pages/star-wars/index/+Page.tsx +22 -0
- package/dist/boilerplates/@batijs/react/files/pages/star-wars/index/+onBeforeRender.ts +80 -0
- package/dist/boilerplates/@batijs/react/files/pages/star-wars/types.ts +13 -0
- package/dist/boilerplates/@batijs/react/package-MZ4IK25N.js +70 -0
- package/dist/boilerplates/@batijs/shared/files/package.json +2 -2
- package/dist/boilerplates/@batijs/shared/files/tsconfig.json +18 -18
- package/dist/boilerplates/@batijs/shared/files/vite.config.ts +5 -5
- package/dist/boilerplates/@batijs/solid/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/solid/files/assets/logo.svg +36 -36
- package/dist/boilerplates/@batijs/solid/files/components/Link.tsx +14 -14
- package/dist/boilerplates/@batijs/solid/files/layouts/HeadDefault.tsx +22 -22
- package/dist/boilerplates/@batijs/solid/files/layouts/LayoutDefault.tsx +87 -87
- package/dist/boilerplates/@batijs/solid/files/layouts/style.css +29 -29
- package/dist/boilerplates/@batijs/solid/files/pages/+config.ts +13 -13
- package/dist/boilerplates/@batijs/solid/files/pages/_error/+Page.tsx +18 -18
- package/dist/boilerplates/@batijs/solid/files/pages/index/+Page.tsx +21 -21
- package/dist/boilerplates/@batijs/solid/files/pages/index/Counter.tsx +18 -18
- package/dist/boilerplates/@batijs/solid/files/pages/star-wars/@id/+Page.tsx +14 -14
- package/dist/boilerplates/@batijs/solid/files/pages/star-wars/@id/+onBeforeRender.ts +27 -27
- package/dist/boilerplates/@batijs/solid/files/pages/star-wars/filterMovieData.ts +11 -11
- package/dist/boilerplates/@batijs/solid/files/pages/star-wars/index/+Page.tsx +22 -22
- package/dist/boilerplates/@batijs/solid/files/pages/star-wars/index/+onBeforeRender.ts +80 -80
- package/dist/boilerplates/@batijs/solid/files/pages/star-wars/types.ts +13 -13
- package/dist/boilerplates/@batijs/solid/{package-DVZ6BETH.js → package-T22CK2KR.js} +1 -1
- package/dist/boilerplates/@batijs/tailwindcss/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/tailwindcss/files/layouts/tailwind.css +2 -2
- package/dist/boilerplates/@batijs/tailwindcss/files/postcss.config.js +6 -6
- package/dist/boilerplates/@batijs/tailwindcss/files/tailwind.config.js +8 -8
- package/dist/boilerplates/@batijs/tailwindcss/{package-7CSFX2AA.js → package-DRVAXC5Y.js} +1 -1
- package/dist/boilerplates/@batijs/telefunc/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/telefunc/{package-42IE3DIX.js → package-G7FSLIMJ.js} +2 -2
- package/dist/boilerplates/boilerplates.json +12 -0
- package/dist/index.js +4 -4
- package/package.json +7 -7
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
// Default <head> (can be overriden by pages)
|
|
2
|
-
|
|
3
|
-
import logoUrl from "../assets/logo.svg";
|
|
4
|
-
|
|
5
|
-
export default function HeadDefault() {
|
|
6
|
-
if (import.meta.BATI_MODULES?.includes("analytics:plausible.io")) {
|
|
7
|
-
return (
|
|
8
|
-
<>
|
|
9
|
-
<link rel="icon" href={logoUrl} />
|
|
10
|
-
{/* See https://plausible.io/docs/plausible-script */}
|
|
11
|
-
{/* TODO: update data-domain */}
|
|
12
|
-
<script defer data-domain="yourdomain.com" src="https://plausible.io/js/script.js"></script>
|
|
13
|
-
</>
|
|
14
|
-
);
|
|
15
|
-
} else {
|
|
16
|
-
return (
|
|
17
|
-
<>
|
|
18
|
-
<link rel="icon" href={logoUrl} />
|
|
19
|
-
</>
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
1
|
+
// Default <head> (can be overriden by pages)
|
|
2
|
+
|
|
3
|
+
import logoUrl from "../assets/logo.svg";
|
|
4
|
+
|
|
5
|
+
export default function HeadDefault() {
|
|
6
|
+
if (import.meta.BATI_MODULES?.includes("analytics:plausible.io")) {
|
|
7
|
+
return (
|
|
8
|
+
<>
|
|
9
|
+
<link rel="icon" href={logoUrl} />
|
|
10
|
+
{/* See https://plausible.io/docs/plausible-script */}
|
|
11
|
+
{/* TODO: update data-domain */}
|
|
12
|
+
<script defer data-domain="yourdomain.com" src="https://plausible.io/js/script.js"></script>
|
|
13
|
+
</>
|
|
14
|
+
);
|
|
15
|
+
} else {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<link rel="icon" href={logoUrl} />
|
|
19
|
+
</>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import "./style.css";
|
|
2
|
-
//# import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
3
|
-
import "./tailwind.css";
|
|
4
|
-
import logoUrl from "../assets/logo.svg";
|
|
5
|
-
import { Link } from "../components/Link";
|
|
6
|
-
import type { JSX } from "solid-js";
|
|
7
|
-
|
|
8
|
-
export default function LayoutDefault(props: { children?: JSX.Element }) {
|
|
9
|
-
return (
|
|
10
|
-
<div
|
|
11
|
-
//# import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
12
|
-
class="flex max-w-5xl m-auto"
|
|
13
|
-
//# !import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
14
|
-
style={{
|
|
15
|
-
display: "flex",
|
|
16
|
-
"max-width": "900px",
|
|
17
|
-
margin: "auto",
|
|
18
|
-
}}
|
|
19
|
-
>
|
|
20
|
-
<Sidebar>
|
|
21
|
-
<Logo />
|
|
22
|
-
<Link href="/">Welcome</Link>
|
|
23
|
-
<Link href="/star-wars">Data Fetching</Link>
|
|
24
|
-
</Sidebar>
|
|
25
|
-
<Content>{props.children}</Content>
|
|
26
|
-
</div>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function Sidebar(props: { children: JSX.Element }) {
|
|
31
|
-
return (
|
|
32
|
-
<div
|
|
33
|
-
id="sidebar"
|
|
34
|
-
//# import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
35
|
-
class="p-5 flex flex-col shrink-0 border-r-2 border-r-gray-200"
|
|
36
|
-
//# !import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
37
|
-
style={{
|
|
38
|
-
padding: "20px",
|
|
39
|
-
"flex-shrink": 0,
|
|
40
|
-
display: "flex",
|
|
41
|
-
"flex-direction": "column",
|
|
42
|
-
"line-height": "1.8em",
|
|
43
|
-
"border-right": "2px solid #eee",
|
|
44
|
-
}}
|
|
45
|
-
>
|
|
46
|
-
{props.children}
|
|
47
|
-
</div>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function Content(props: { children: JSX.Element }) {
|
|
52
|
-
return (
|
|
53
|
-
<div id="page-container">
|
|
54
|
-
<div
|
|
55
|
-
id="page-content"
|
|
56
|
-
//# import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
57
|
-
class="p-5 pb-12 min-h-screen"
|
|
58
|
-
//# !import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
59
|
-
style={{
|
|
60
|
-
padding: "20px",
|
|
61
|
-
"padding-bottom": "50px",
|
|
62
|
-
"min-height": "100vh",
|
|
63
|
-
}}
|
|
64
|
-
>
|
|
65
|
-
{props.children}
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function Logo() {
|
|
72
|
-
return (
|
|
73
|
-
<div
|
|
74
|
-
//# import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
75
|
-
class="p-5 mb-2"
|
|
76
|
-
//# !import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
77
|
-
style={{
|
|
78
|
-
"margin-top": "20px",
|
|
79
|
-
"margin-bottom": "10px",
|
|
80
|
-
}}
|
|
81
|
-
>
|
|
82
|
-
<a href="/">
|
|
83
|
-
<img src={logoUrl} height={64} width={64} />
|
|
84
|
-
</a>
|
|
85
|
-
</div>
|
|
86
|
-
);
|
|
87
|
-
}
|
|
1
|
+
import "./style.css";
|
|
2
|
+
//# import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
3
|
+
import "./tailwind.css";
|
|
4
|
+
import logoUrl from "../assets/logo.svg";
|
|
5
|
+
import { Link } from "../components/Link";
|
|
6
|
+
import type { JSX } from "solid-js";
|
|
7
|
+
|
|
8
|
+
export default function LayoutDefault(props: { children?: JSX.Element }) {
|
|
9
|
+
return (
|
|
10
|
+
<div
|
|
11
|
+
//# import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
12
|
+
class="flex max-w-5xl m-auto"
|
|
13
|
+
//# !import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
14
|
+
style={{
|
|
15
|
+
display: "flex",
|
|
16
|
+
"max-width": "900px",
|
|
17
|
+
margin: "auto",
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
20
|
+
<Sidebar>
|
|
21
|
+
<Logo />
|
|
22
|
+
<Link href="/">Welcome</Link>
|
|
23
|
+
<Link href="/star-wars">Data Fetching</Link>
|
|
24
|
+
</Sidebar>
|
|
25
|
+
<Content>{props.children}</Content>
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function Sidebar(props: { children: JSX.Element }) {
|
|
31
|
+
return (
|
|
32
|
+
<div
|
|
33
|
+
id="sidebar"
|
|
34
|
+
//# import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
35
|
+
class="p-5 flex flex-col shrink-0 border-r-2 border-r-gray-200"
|
|
36
|
+
//# !import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
37
|
+
style={{
|
|
38
|
+
padding: "20px",
|
|
39
|
+
"flex-shrink": 0,
|
|
40
|
+
display: "flex",
|
|
41
|
+
"flex-direction": "column",
|
|
42
|
+
"line-height": "1.8em",
|
|
43
|
+
"border-right": "2px solid #eee",
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
{props.children}
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function Content(props: { children: JSX.Element }) {
|
|
52
|
+
return (
|
|
53
|
+
<div id="page-container">
|
|
54
|
+
<div
|
|
55
|
+
id="page-content"
|
|
56
|
+
//# import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
57
|
+
class="p-5 pb-12 min-h-screen"
|
|
58
|
+
//# !import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
59
|
+
style={{
|
|
60
|
+
padding: "20px",
|
|
61
|
+
"padding-bottom": "50px",
|
|
62
|
+
"min-height": "100vh",
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
{props.children}
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function Logo() {
|
|
72
|
+
return (
|
|
73
|
+
<div
|
|
74
|
+
//# import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
75
|
+
class="p-5 mb-2"
|
|
76
|
+
//# !import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
77
|
+
style={{
|
|
78
|
+
"margin-top": "20px",
|
|
79
|
+
"margin-bottom": "10px",
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
<a href="/">
|
|
83
|
+
<img src={logoUrl} height={64} width={64} />
|
|
84
|
+
</a>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
/* Links */
|
|
2
|
-
a {
|
|
3
|
-
text-decoration: none;
|
|
4
|
-
}
|
|
5
|
-
#sidebar a {
|
|
6
|
-
padding: 2px 10px;
|
|
7
|
-
margin-left: -10px;
|
|
8
|
-
}
|
|
9
|
-
#sidebar a.is-active {
|
|
10
|
-
background-color: #eee;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/* Reset */
|
|
14
|
-
body {
|
|
15
|
-
margin: 0;
|
|
16
|
-
font-family: sans-serif;
|
|
17
|
-
}
|
|
18
|
-
* {
|
|
19
|
-
box-sizing: border-box;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/* Page Transition Anmiation */
|
|
23
|
-
#page-content {
|
|
24
|
-
opacity: 1;
|
|
25
|
-
transition: opacity 0.3s ease-in-out;
|
|
26
|
-
}
|
|
27
|
-
body.page-is-transitioning #page-content {
|
|
28
|
-
opacity: 0;
|
|
29
|
-
}
|
|
1
|
+
/* Links */
|
|
2
|
+
a {
|
|
3
|
+
text-decoration: none;
|
|
4
|
+
}
|
|
5
|
+
#sidebar a {
|
|
6
|
+
padding: 2px 10px;
|
|
7
|
+
margin-left: -10px;
|
|
8
|
+
}
|
|
9
|
+
#sidebar a.is-active {
|
|
10
|
+
background-color: #eee;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* Reset */
|
|
14
|
+
body {
|
|
15
|
+
margin: 0;
|
|
16
|
+
font-family: sans-serif;
|
|
17
|
+
}
|
|
18
|
+
* {
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Page Transition Anmiation */
|
|
23
|
+
#page-content {
|
|
24
|
+
opacity: 1;
|
|
25
|
+
transition: opacity 0.3s ease-in-out;
|
|
26
|
+
}
|
|
27
|
+
body.page-is-transitioning #page-content {
|
|
28
|
+
opacity: 0;
|
|
29
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { Config } from "vike-solid";
|
|
2
|
-
import Layout from "../layouts/LayoutDefault";
|
|
3
|
-
import Head from "../layouts/HeadDefault";
|
|
4
|
-
|
|
5
|
-
// Default config (can be overriden by pages)
|
|
6
|
-
export default {
|
|
7
|
-
Layout,
|
|
8
|
-
Head,
|
|
9
|
-
// <title>
|
|
10
|
-
title: "My Vike App",
|
|
11
|
-
// <meta name="description">
|
|
12
|
-
description: "Demo showcasing Vike",
|
|
13
|
-
} satisfies Config;
|
|
1
|
+
import type { Config } from "vike-solid";
|
|
2
|
+
import Layout from "../layouts/LayoutDefault";
|
|
3
|
+
import Head from "../layouts/HeadDefault";
|
|
4
|
+
|
|
5
|
+
// Default config (can be overriden by pages)
|
|
6
|
+
export default {
|
|
7
|
+
Layout,
|
|
8
|
+
Head,
|
|
9
|
+
// <title>
|
|
10
|
+
title: "My Vike App",
|
|
11
|
+
// <meta name="description">
|
|
12
|
+
description: "Demo showcasing Vike",
|
|
13
|
+
} satisfies Config;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export default function Page(props: { is404: boolean; errorInfo?: string }) {
|
|
2
|
-
if (props.is404) {
|
|
3
|
-
return (
|
|
4
|
-
<>
|
|
5
|
-
<h1>404 Page Not Found</h1>
|
|
6
|
-
<p>This page could not be found.</p>
|
|
7
|
-
<p>{props.errorInfo}</p>
|
|
8
|
-
</>
|
|
9
|
-
);
|
|
10
|
-
} else {
|
|
11
|
-
return (
|
|
12
|
-
<>
|
|
13
|
-
<h1>500 Internal Server Error</h1>
|
|
14
|
-
<p>Something went wrong.</p>
|
|
15
|
-
</>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
1
|
+
export default function Page(props: { is404: boolean; errorInfo?: string }) {
|
|
2
|
+
if (props.is404) {
|
|
3
|
+
return (
|
|
4
|
+
<>
|
|
5
|
+
<h1>404 Page Not Found</h1>
|
|
6
|
+
<p>This page could not be found.</p>
|
|
7
|
+
<p>{props.errorInfo}</p>
|
|
8
|
+
</>
|
|
9
|
+
);
|
|
10
|
+
} else {
|
|
11
|
+
return (
|
|
12
|
+
<>
|
|
13
|
+
<h1>500 Internal Server Error</h1>
|
|
14
|
+
<p>Something went wrong.</p>
|
|
15
|
+
</>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { Counter } from "./Counter";
|
|
2
|
-
|
|
3
|
-
export default function Page() {
|
|
4
|
-
return (
|
|
5
|
-
<>
|
|
6
|
-
<h1
|
|
7
|
-
//# import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
8
|
-
class="font-bold text-3xl pb-4"
|
|
9
|
-
>
|
|
10
|
-
My Vike app
|
|
11
|
-
</h1>
|
|
12
|
-
This page is:
|
|
13
|
-
<ul>
|
|
14
|
-
<li>Rendered to HTML.</li>
|
|
15
|
-
<li>
|
|
16
|
-
Interactive. <Counter />
|
|
17
|
-
</li>
|
|
18
|
-
</ul>
|
|
19
|
-
</>
|
|
20
|
-
);
|
|
21
|
-
}
|
|
1
|
+
import { Counter } from "./Counter";
|
|
2
|
+
|
|
3
|
+
export default function Page() {
|
|
4
|
+
return (
|
|
5
|
+
<>
|
|
6
|
+
<h1
|
|
7
|
+
//# import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
8
|
+
class="font-bold text-3xl pb-4"
|
|
9
|
+
>
|
|
10
|
+
My Vike app
|
|
11
|
+
</h1>
|
|
12
|
+
This page is:
|
|
13
|
+
<ul>
|
|
14
|
+
<li>Rendered to HTML.</li>
|
|
15
|
+
<li>
|
|
16
|
+
Interactive. <Counter />
|
|
17
|
+
</li>
|
|
18
|
+
</ul>
|
|
19
|
+
</>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { createSignal } from "solid-js";
|
|
2
|
-
|
|
3
|
-
export { Counter };
|
|
4
|
-
|
|
5
|
-
function Counter() {
|
|
6
|
-
const [count, setCount] = createSignal(0);
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<button
|
|
10
|
-
type="button"
|
|
11
|
-
//# import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
12
|
-
class="inline-block border border-black rounded bg-gray-200 px-2 py-1 text-xs font-medium uppercase leading-normal"
|
|
13
|
-
onClick={() => setCount((count) => count + 1)}
|
|
14
|
-
>
|
|
15
|
-
Counter {count()}
|
|
16
|
-
</button>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
1
|
+
import { createSignal } from "solid-js";
|
|
2
|
+
|
|
3
|
+
export { Counter };
|
|
4
|
+
|
|
5
|
+
function Counter() {
|
|
6
|
+
const [count, setCount] = createSignal(0);
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<button
|
|
10
|
+
type="button"
|
|
11
|
+
//# import.meta.BATI_MODULES?.includes("uikit:tailwindcss")
|
|
12
|
+
class="inline-block border border-black rounded bg-gray-200 px-2 py-1 text-xs font-medium uppercase leading-normal"
|
|
13
|
+
onClick={() => setCount((count) => count + 1)}
|
|
14
|
+
>
|
|
15
|
+
Counter {count()}
|
|
16
|
+
</button>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { MovieDetails } from "../types";
|
|
2
|
-
|
|
3
|
-
export default function Page(props: { movie: MovieDetails }) {
|
|
4
|
-
return (
|
|
5
|
-
<>
|
|
6
|
-
<h1>{props.movie.title}</h1>
|
|
7
|
-
Release Date: {props.movie.release_date}
|
|
8
|
-
<br />
|
|
9
|
-
Director: {props.movie.director}
|
|
10
|
-
<br />
|
|
11
|
-
Producer: {props.movie.producer}
|
|
12
|
-
</>
|
|
13
|
-
);
|
|
14
|
-
}
|
|
1
|
+
import type { MovieDetails } from "../types";
|
|
2
|
+
|
|
3
|
+
export default function Page(props: { movie: MovieDetails }) {
|
|
4
|
+
return (
|
|
5
|
+
<>
|
|
6
|
+
<h1>{props.movie.title}</h1>
|
|
7
|
+
Release Date: {props.movie.release_date}
|
|
8
|
+
<br />
|
|
9
|
+
Director: {props.movie.director}
|
|
10
|
+
<br />
|
|
11
|
+
Producer: {props.movie.producer}
|
|
12
|
+
</>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
export default onBeforeRender;
|
|
2
|
-
|
|
3
|
-
import fetch from "cross-fetch";
|
|
4
|
-
import { filterMovieData } from "../filterMovieData";
|
|
5
|
-
import type { PageContextBuiltIn } from "vike-solid";
|
|
6
|
-
import type { MovieDetails } from "../types";
|
|
7
|
-
|
|
8
|
-
async function onBeforeRender(pageContext: PageContextBuiltIn) {
|
|
9
|
-
const response = await fetch(`https://star-wars.brillout.com/api/films/${pageContext.routeParams.id}.json`);
|
|
10
|
-
let movie = (await response.json()) as MovieDetails;
|
|
11
|
-
|
|
12
|
-
// We remove data we don't need because we pass `pageContext.movie` to
|
|
13
|
-
// the client; we want to minimize what is sent over the network.
|
|
14
|
-
movie = filterMovieData(movie);
|
|
15
|
-
|
|
16
|
-
const { title } = movie;
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
pageContext: {
|
|
20
|
-
pageProps: {
|
|
21
|
-
movie,
|
|
22
|
-
},
|
|
23
|
-
// The page's <title>
|
|
24
|
-
title,
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
}
|
|
1
|
+
export default onBeforeRender;
|
|
2
|
+
|
|
3
|
+
import fetch from "cross-fetch";
|
|
4
|
+
import { filterMovieData } from "../filterMovieData";
|
|
5
|
+
import type { PageContextBuiltIn } from "vike-solid";
|
|
6
|
+
import type { MovieDetails } from "../types";
|
|
7
|
+
|
|
8
|
+
async function onBeforeRender(pageContext: PageContextBuiltIn) {
|
|
9
|
+
const response = await fetch(`https://star-wars.brillout.com/api/films/${pageContext.routeParams.id}.json`);
|
|
10
|
+
let movie = (await response.json()) as MovieDetails;
|
|
11
|
+
|
|
12
|
+
// We remove data we don't need because we pass `pageContext.movie` to
|
|
13
|
+
// the client; we want to minimize what is sent over the network.
|
|
14
|
+
movie = filterMovieData(movie);
|
|
15
|
+
|
|
16
|
+
const { title } = movie;
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
pageContext: {
|
|
20
|
+
pageProps: {
|
|
21
|
+
movie,
|
|
22
|
+
},
|
|
23
|
+
// The page's <title>
|
|
24
|
+
title,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { MovieDetails } from "./types";
|
|
2
|
-
|
|
3
|
-
export { filterMovieData };
|
|
4
|
-
|
|
5
|
-
function filterMovieData(
|
|
6
|
-
movie: MovieDetails & Record<string, unknown>
|
|
7
|
-
): MovieDetails {
|
|
8
|
-
const { id, title, release_date, director, producer } = movie;
|
|
9
|
-
movie = { id, title, release_date, director, producer };
|
|
10
|
-
return movie;
|
|
11
|
-
}
|
|
1
|
+
import type { MovieDetails } from "./types";
|
|
2
|
+
|
|
3
|
+
export { filterMovieData };
|
|
4
|
+
|
|
5
|
+
function filterMovieData(
|
|
6
|
+
movie: MovieDetails & Record<string, unknown>
|
|
7
|
+
): MovieDetails {
|
|
8
|
+
const { id, title, release_date, director, producer } = movie;
|
|
9
|
+
movie = { id, title, release_date, director, producer };
|
|
10
|
+
return movie;
|
|
11
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { For } from "solid-js";
|
|
2
|
-
import type { Movie } from "../types";
|
|
3
|
-
|
|
4
|
-
export default function Page(props: { movies: Movie[] }) {
|
|
5
|
-
return (
|
|
6
|
-
<>
|
|
7
|
-
<h1>Star Wars Movies</h1>
|
|
8
|
-
<ol>
|
|
9
|
-
<For each={props.movies}>
|
|
10
|
-
{(movie, i) => (
|
|
11
|
-
<li>
|
|
12
|
-
<a href={`/star-wars/${movie.id}`}>{movie.title}</a> ({movie.release_date})
|
|
13
|
-
</li>
|
|
14
|
-
)}
|
|
15
|
-
</For>
|
|
16
|
-
</ol>
|
|
17
|
-
<p>
|
|
18
|
-
Source: <a href="https://star-wars.brillout.com">star-wars.brillout.com</a>.
|
|
19
|
-
</p>
|
|
20
|
-
</>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
1
|
+
import { For } from "solid-js";
|
|
2
|
+
import type { Movie } from "../types";
|
|
3
|
+
|
|
4
|
+
export default function Page(props: { movies: Movie[] }) {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<h1>Star Wars Movies</h1>
|
|
8
|
+
<ol>
|
|
9
|
+
<For each={props.movies}>
|
|
10
|
+
{(movie, i) => (
|
|
11
|
+
<li>
|
|
12
|
+
<a href={`/star-wars/${movie.id}`}>{movie.title}</a> ({movie.release_date})
|
|
13
|
+
</li>
|
|
14
|
+
)}
|
|
15
|
+
</For>
|
|
16
|
+
</ol>
|
|
17
|
+
<p>
|
|
18
|
+
Source: <a href="https://star-wars.brillout.com">star-wars.brillout.com</a>.
|
|
19
|
+
</p>
|
|
20
|
+
</>
|
|
21
|
+
);
|
|
22
|
+
}
|