refactor: migrate to Svelte 5

use runes ($props, $state, $derived, $effect, etc)
This commit is contained in:
2024-08-02 17:50:16 +02:00
parent 245049222b
commit 6f8a619af2
60 changed files with 1120 additions and 859 deletions

View File

@@ -6,19 +6,30 @@
import { cx } from 'classix'
import Image from '$components/atoms/Image.svelte'
export let street: string
export let location: string
export let region: string = undefined
export let country: string
export let flagId: string
export let size: string = undefined
let {
street,
location,
region,
country,
flagId,
size,
...props
}: {
street: string
location: string
region?: string
country: string
flagId: string
size?: string
class?: string
} = $props()
const className = 'postcard'
$: classes = cx(
className,
...[size].map(variant => variant && `${className}--${variant}`),
$$props.class
)
const cardClass = 'postcard'
const classes = $derived(cx(
cardClass,
...[size].map(variant => variant && `${cardClass}--${variant}`),
props.class,
))
</script>
<div class={classes}>