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

+38 -16
View File
@@ -8,17 +8,33 @@
Icon,
} from 'svelte-hero-icons'
export let supportedPlatforms = {
interface Props {
supportedPlatforms?: any;
mainClass?: string;
itemsClass?: string;
optionClass?: string;
class?: string;
title?: import('svelte').Snippet;
description?: import('svelte').Snippet;
children?: import('svelte').Snippet;
}
let {
supportedPlatforms = {
desktop: true,
tablet: true,
mobile: true,
}
export let mainClass: string = ''
export let itemsClass: string = ''
export let optionClass: string = ''
let clazz: string = ''
export { clazz as class }
},
mainClass = '',
itemsClass = '',
optionClass = '',
class: clazz = '',
title,
description,
children
}: Props = $props();
</script>
<div
@@ -28,19 +44,25 @@
<div class="flex items-center gap-2 flex-wrap">
{#if supportedPlatforms.desktop}
<Badge>
<Icon src={ComputerDesktop} micro size="14" slot="icon" />
{#snippet icon()}
<Icon src={ComputerDesktop} micro size="14" />
{/snippet}
{$t('settings.desktop')}
</Badge>
{/if}
{#if supportedPlatforms.tablet}
<Badge>
<Icon src={DeviceTablet} micro size="14" slot="icon" />
{#snippet icon()}
<Icon src={DeviceTablet} micro size="14" />
{/snippet}
{$t('settings.tablet')}
</Badge>
{/if}
{#if supportedPlatforms.mobile}
<Badge>
<Icon src={DevicePhoneMobile} micro size="14" slot="icon" />
{#snippet icon()}
<Icon src={DevicePhoneMobile} micro size="14" />
{/snippet}
{$t('settings.mobile')}
</Badge>
{/if}
@@ -52,19 +74,19 @@
<div
class="flex flex-col gap-0.5 flex-[2] w-full flex-shrink-0 min-w-48 {clazz}"
>
<h1 class="font-medium text-base"><slot name="title" /></h1>
{#if $$slots.description}
<h1 class="font-medium text-base">{@render title?.()}</h1>
{#if description}
<p class="text-slate-800 dark:text-zinc-200 text-sm">
<slot name="description" />
{@render description?.()}
</p>
{/if}
</div>
{#if $$slots.default}
{#if children}
<div
class="w-full flex flex-col gap-2 flex-1 max-w-full
@md/setting:items-end flex-shrink-0 {optionClass}"
>
<slot />
{@render children?.()}
</div>
{/if}
</div>