Migrates to svelte 5

This commit is contained in:
Christian Beutel
2025-01-24 17:46:13 +01:00
parent 7571f6e9b9
commit 3721b7f537
106 changed files with 5524 additions and 4232 deletions

View File

@@ -1,18 +1,22 @@
<script lang="ts">
import { onMount } from "svelte";
import { cubicOut } from "svelte/easing";
import { tweened } from "svelte/motion";
import { Tween } from "svelte/motion";
export let tabs: string[];
export let activeTab: number;
export let extraClasses: string = "";
interface Props {
tabs: string[];
activeTab: number;
extraClasses?: string;
}
const indicatorPosition = tweened(0, {
let { tabs, activeTab = $bindable(), extraClasses = "" }: Props = $props();
const indicatorPosition = new Tween(0, {
duration: 300,
easing: cubicOut,
});
const indicatorWidth = tweened(0, {
const indicatorWidth = new Tween(0, {
duration: 300,
easing: cubicOut,
});
@@ -37,13 +41,13 @@
<div id="tabs" class="flex gap-2 overflow-x-auto relative {extraClasses}">
<div
class="absolute h-full bg-menu-item-background-hover rounded-t-lg top-0 z-0"
style="width: {$indicatorWidth}px; left: {$indicatorPosition}px;"
style="width: {indicatorWidth.current}px; left: {indicatorPosition.current}px;"
></div>
{#each tabs as tab, i}
<button
class="tab z-10"
class:tab-active={activeTab == i}
on:click={() => switchTabs(i)}>{tab}</button
onclick={() => switchTabs(i)}>{tab}</button
>
{/each}
</div>