migrate: convert most components to svelte 5

This commit is contained in:
Xylight committed 2024-10-25 19:33:27 -07:00
1 parent d670f39f0a
commit 10ef4123da
225 files changed
+5441 -3341

No files matched your search

+16 -8
View File
@@ -1,15 +1,21 @@
<script lang="ts">
import { preventDefault } from 'svelte/legacy';
import { t } from '$lib/translations'
import { calculateVars, themeData, type Theme } from '$lib/ui/colors'
import { action, Button, Material, modal, TextInput } from 'mono-svelte'
import { CheckCircle, Icon, Trash } from 'svelte-hero-icons'
export let theme: Theme
interface Props {
theme: Theme;
}
let editingName = false
let { theme = $bindable() }: Props = $props();
let editingName = $state(false)
</script>
<button class="h-full" on:click={() => ($themeData.currentTheme = theme.id)}>
<button class="h-full" onclick={() => ($themeData.currentTheme = theme.id)}>
<Material
padding="none"
class="{theme.id == $themeData.currentTheme
@@ -27,10 +33,10 @@
</div>
<div
class="bg-white dark:bg-zinc-900 w-8 h-4 rounded-sm border border-slate-200 dark:border-zinc-800"
/>
></div>
<div
class="w-3 h-3 bg-primary-900 dark:bg-primary-100 rounded-full ml-auto"
/>
></div>
</div>
{#if theme.id == $themeData.currentTheme}
<Icon
@@ -42,12 +48,12 @@
{/if}
<div class="px-4 py-2 flex items-center gap-1 justify-between">
{#if editingName}
<form on:submit|preventDefault={() => (editingName = false)}>
<form onsubmit={preventDefault(() => (editingName = false))}>
<TextInput bind:value={theme.name}></TextInput>
</form>
{:else}
<button
on:click={() => {
onclick={() => {
if (theme.id > 0) editingName = true
}}
class="text-left font-medium text-lg font-display"
@@ -90,7 +96,9 @@
})
}}
>
<Icon src={Trash} size="16" mini slot="prefix" />
{#snippet prefix()}
<Icon src={Trash} size="16" mini />
{/snippet}
</Button>
{/if}
</div>