summaryrefslogtreecommitdiff
path: root/client/src/App.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/App.svelte')
-rw-r--r--client/src/App.svelte33
1 files changed, 33 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>