From dc4db405d2991d3ec6a114f3b08d3fccd057d3ee Mon Sep 17 00:00:00 2001
From: Wolfgang Müller
Date: Thu, 13 Feb 2025 17:52:16 +0100
Subject: frontend: Migrate to Svelte 5

---
 frontend/src/lib/tabs/Tab.svelte | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

(limited to 'frontend/src/lib/tabs/Tab.svelte')

diff --git a/frontend/src/lib/tabs/Tab.svelte b/frontend/src/lib/tabs/Tab.svelte
index cddd072..f8dc67c 100644
--- a/frontend/src/lib/tabs/Tab.svelte
+++ b/frontend/src/lib/tabs/Tab.svelte
@@ -1,14 +1,28 @@
 <script lang="ts">
-	import { getTabContext } from '$lib/Tabs';
 	import { fadeDefault } from '$lib/Transitions';
+	import type { Snippet } from 'svelte';
 	import { fade } from 'svelte/transition';
+	import { getTabContext } from './Tabs.svelte';
+
+	interface Props {
+		id: string;
+		title: string;
+		initial?: boolean;
+		children: Snippet;
+	}
+
+	let { id, title, initial = false, children }: Props = $props();
 
 	const context = getTabContext();
-	export let id: string;
+
+	context.tabs = { ...context.tabs, [id]: { title } };
+	if (initial) {
+		context.current = id;
+	}
 </script>
 
-{#if $context.current === id}
+{#if context.current === id}
 	<div class="h-full overflow-auto py-2 pe-3 ps-1" in:fade={fadeDefault}>
-		<slot />
+		{@render children?.()}
 	</div>
 {/if}
-- 
cgit v1.2.3-2-gb3c3

