summaryrefslogtreecommitdiff
path: root/client/src/App.svelte
diff options
context:
space:
mode:
authorSteven Le Rouzic <steven.lerouzic@gmail.com>2025-05-11 23:42:35 +0200
committerSteven Le Rouzic <steven.lerouzic@gmail.com>2025-05-12 02:20:50 +0200
commit8b5b3dd00cc16c351670a25933f4b37a604abaf8 (patch)
treeaa5b32286ed880440c697e3b7cb251d74ad30029 /client/src/App.svelte
Initial commitHEADmain
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>