migrate: convert most components to svelte 5
This commit is contained in:
1 parent
d670f39f0a
commit
10ef4123da
225 files changed
+5441
-3341
No files matched your search
@@ -6,28 +6,46 @@
|
||||
import { optimizeImageURL } from '../lemmy/post/helpers'
|
||||
import FormattedNumber from '../util/FormattedNumber.svelte'
|
||||
|
||||
export let avatar: string | undefined = undefined
|
||||
export let name: string
|
||||
export let bio: string | undefined = undefined
|
||||
export let banner: string | undefined = undefined
|
||||
export let url: string | undefined = undefined
|
||||
export let stats: {
|
||||
interface Props {
|
||||
avatar?: string | undefined
|
||||
name: string
|
||||
value: string
|
||||
format?: boolean
|
||||
}[] = []
|
||||
bio?: string | undefined
|
||||
banner?: string | undefined
|
||||
url?: string | undefined
|
||||
stats?: {
|
||||
name: string
|
||||
value: string
|
||||
format?: boolean
|
||||
}[]
|
||||
center?: boolean
|
||||
class?: string
|
||||
nameDetail?: import('svelte').Snippet
|
||||
actions?: import('svelte').Snippet
|
||||
children?: import('svelte').Snippet
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export let center: boolean = false
|
||||
|
||||
let clazz: string = ''
|
||||
export { clazz as class }
|
||||
let {
|
||||
avatar = undefined,
|
||||
name,
|
||||
bio = undefined,
|
||||
banner = undefined,
|
||||
url = undefined,
|
||||
stats = [],
|
||||
center = false,
|
||||
class: clazz = '',
|
||||
nameDetail,
|
||||
actions,
|
||||
children,
|
||||
...rest
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
<Material
|
||||
color="transparent"
|
||||
padding="none"
|
||||
rounding="xl"
|
||||
{...$$restProps}
|
||||
{...rest}
|
||||
class="z-10 relative border-slate-200 dark:border-zinc-700 {clazz}"
|
||||
>
|
||||
{#if banner || avatar}
|
||||
@@ -72,12 +90,12 @@
|
||||
<span
|
||||
class="flex items-center gap-0 text-sm text-slate-600 dark:text-zinc-400 max-w-full w-max"
|
||||
>
|
||||
<slot name="nameDetail" />
|
||||
{@render nameDetail?.()}
|
||||
</span>
|
||||
|
||||
{#if $$slots.actions}
|
||||
{#if actions}
|
||||
<div class="flex flex-col mt-2">
|
||||
<slot name="actions" />
|
||||
{@render actions?.()}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -118,7 +136,7 @@
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
</div>
|
||||
</Material>
|
||||
|
||||
|
||||
Reference in new issue
Block a user