Skip to content

Commit 42dd1f5

Browse files
committed
refactor: migrate layout to new SvelteKit component syntax and event handlers
1 parent d54f622 commit 42dd1f5

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

apps/web/src/routes/+layout.svelte

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import { browser } from '$app/environment';
3-
import { page } from '$app/stores';
3+
import { page } from '$app/state';
44
import {
55
PUBLIC_FATHOM_ID,
66
PUBLIC_FATHOM_URL,
@@ -12,15 +12,17 @@
1212
import '../app.css';
1313
import '../prism.css';
1414
15-
export let data;
15+
let { data, children } = $props();
1616
1717
onMount(() => {
1818
Fathom.load(PUBLIC_FATHOM_ID, {
1919
url: PUBLIC_FATHOM_URL,
2020
});
2121
});
2222
23-
$: $page.url.pathname, browser && Fathom.trackPageview();
23+
$effect(() => {
24+
page.url.pathname, browser && Fathom.trackPageview();
25+
});
2426
</script>
2527

2628
<header class="text-right">
@@ -31,8 +33,7 @@
3133
<div class="flex-none items-center">
3234
<a
3335
aria-label="Github"
34-
on:click={() =>
35-
Fathom.trackEvent(`GitHub project link click`)}
36+
onclick={() => Fathom.trackEvent(`GitHub project link click`)}
3637
target="_blank"
3738
href="https://github.com/spences10/sveltekit-embed"
3839
rel="noopener noreferrer"
@@ -71,11 +72,11 @@
7172
{/if}
7273

7374
<main class="prose prose-xl container mx-auto mb-20 max-w-3xl px-4">
74-
<slot />
75+
{@render children?.()}
7576
</main>
7677

7778
<footer
78-
class="footer footer-center bg-primary text-primary-content p-10"
79+
class="footer footer-horizontal footer-center bg-primary text-primary-content p-10"
7980
>
8081
<div class="text-xl">
8182
<img
@@ -87,7 +88,7 @@
8788
Made with <span role="img" aria-label="red heart">❤️</span> by
8889
<a
8990
class="link hover:text-secondary transition"
90-
on:click={() => Fathom.trackEvent(`scottspence.com click`)}
91+
onclick={() => Fathom.trackEvent(`scottspence.com click`)}
9192
href="https://scottspence.com"
9293
target="_blank"
9394
rel="noopener noreferrer"
@@ -105,7 +106,7 @@
105106
<div class="grid grid-flow-col gap-4">
106107
<a
107108
aria-label="Twitter"
108-
on:click={() => Fathom.trackEvent(`spences10 Twitter click`)}
109+
onclick={() => Fathom.trackEvent(`spences10 Twitter click`)}
109110
target="_blank"
110111
rel="noopener noreferrer"
111112
href="https://twitter.com/spences10"
@@ -114,7 +115,7 @@
114115
</a>
115116
<a
116117
aria-label="GitHub"
117-
on:click={() =>
118+
onclick={() =>
118119
Fathom.trackEvent(`spences10 GitHub link click`)}
119120
target="_blank"
120121
rel="noopener noreferrer"
@@ -124,7 +125,7 @@
124125
</a>
125126
<a
126127
aria-label="YouTube"
127-
on:click={() => Fathom.trackEvent(`spences10 YouTube click`)}
128+
onclick={() => Fathom.trackEvent(`spences10 YouTube click`)}
128129
target="_blank"
129130
rel="noopener noreferrer"
130131
href="https://ss10/yt"

0 commit comments

Comments
 (0)