diff options
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/App.svelte | 33 | ||||
-rw-r--r-- | client/src/main.ts | 9 | ||||
-rw-r--r-- | client/src/pages/Home.svelte | 3 | ||||
-rw-r--r-- | client/src/style.css | 1 | ||||
-rw-r--r-- | client/src/vite-env.d.ts | 2 |
5 files changed, 48 insertions, 0 deletions
diff --git a/client/src/App.svelte b/client/src/App.svelte new file mode 100644 index 0000000..488312f --- /dev/null +++ b/client/src/App.svelte @@ -0,0 +1,33 @@ +<script lang="ts">
+ import page from "page";
+ import { onMount } from "svelte";
+ import type { Component, ComponentProps } from "svelte";
+ import Home from "./pages/Home.svelte";
+
+ let CurrentPage: Component<any> | null = $state(null);
+ let currentPageProps: any = $state({});
+
+ function bindComponent<T extends Component<any>>(
+ component: T,
+ props: ComponentProps<T>,
+ ) {
+ CurrentPage = component;
+ currentPageProps = props;
+ }
+
+ onMount(() => {
+ page("/", () => {
+ bindComponent(Home, {});
+ });
+
+ page.start();
+ });
+</script>
+
+<main>
+ {#if CurrentPage}
+ <CurrentPage {...currentPageProps}></CurrentPage>
+ {:else}
+ <p>No page bound</p>
+ {/if}
+</main>
diff --git a/client/src/main.ts b/client/src/main.ts new file mode 100644 index 0000000..aa59c8a --- /dev/null +++ b/client/src/main.ts @@ -0,0 +1,9 @@ +import { mount } from "svelte"; +import App from "./App.svelte"; +import "./style.css"; + +const app = mount(App, { + target: document.getElementById('app')!, +}) + +export default app diff --git a/client/src/pages/Home.svelte b/client/src/pages/Home.svelte new file mode 100644 index 0000000..2ac8c1a --- /dev/null +++ b/client/src/pages/Home.svelte @@ -0,0 +1,3 @@ +<main> + <p>Hello, world!</p> +</main> diff --git a/client/src/style.css b/client/src/style.css new file mode 100644 index 0000000..a461c50 --- /dev/null +++ b/client/src/style.css @@ -0,0 +1 @@ +@import "tailwindcss";
\ No newline at end of file diff --git a/client/src/vite-env.d.ts b/client/src/vite-env.d.ts new file mode 100644 index 0000000..4078e74 --- /dev/null +++ b/client/src/vite-env.d.ts @@ -0,0 +1,2 @@ +/// <reference types="svelte" /> +/// <reference types="vite/client" /> |