diff options
author | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2025-05-11 23:42:35 +0200 |
---|---|---|
committer | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2025-05-12 02:20:50 +0200 |
commit | 8b5b3dd00cc16c351670a25933f4b37a604abaf8 (patch) | |
tree | aa5b32286ed880440c697e3b7cb251d74ad30029 /client/src/App.svelte |
Diffstat (limited to 'client/src/App.svelte')
-rw-r--r-- | client/src/App.svelte | 33 |
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>
|