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
@@ -2,11 +2,21 @@
|
||||
import { userSettings } from '$lib/settings'
|
||||
import { contentPadding } from '../Shell.svelte'
|
||||
|
||||
export let pageHeader = false
|
||||
interface Props {
|
||||
pageHeader?: boolean
|
||||
style?: string
|
||||
class?: string
|
||||
children?: import('svelte').Snippet
|
||||
extended?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
export let style: string = ''
|
||||
let clazz: string = ''
|
||||
export { clazz as class }
|
||||
let {
|
||||
pageHeader = false,
|
||||
style = '',
|
||||
class: clazz = '',
|
||||
children,
|
||||
extended,
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
<div
|
||||
@@ -27,11 +37,11 @@
|
||||
class="text-3xl font-medium flex gap-2 w-full
|
||||
{$userSettings.font == 'satoshi/nunito' ? 'font-display' : ''} {clazz ?? ''}"
|
||||
>
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
</h1>
|
||||
{#if $$slots.extended}
|
||||
{#if extended}
|
||||
<div class="mt-4">
|
||||
<slot name="extended" />
|
||||
{@render extended?.()}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -3,25 +3,34 @@
|
||||
import { page } from '$app/stores'
|
||||
import { fly } from 'svelte/transition'
|
||||
|
||||
export let routes: {
|
||||
href: string
|
||||
name: string
|
||||
}[]
|
||||
export let currentRoute: string | undefined = undefined
|
||||
export let isSelected: (
|
||||
url: URL,
|
||||
currentRoute: string | undefined,
|
||||
route: string,
|
||||
defaultRoute?: string
|
||||
) => boolean = (url, currentRoute, route) =>
|
||||
(currentRoute ?? url.pathname) == route
|
||||
export let buildUrl: (
|
||||
currentRoute: string | undefined,
|
||||
href: string
|
||||
) => string = (route, href) => href
|
||||
export let defaultRoute: string | undefined = undefined
|
||||
let clazz: string = ''
|
||||
export { clazz as class }
|
||||
interface Props {
|
||||
routes: {
|
||||
href: string
|
||||
name: string
|
||||
}[]
|
||||
currentRoute?: string | undefined
|
||||
isSelected?: (
|
||||
url: URL,
|
||||
currentRoute: string | undefined,
|
||||
route: string,
|
||||
defaultRoute?: string,
|
||||
) => boolean
|
||||
buildUrl?: (currentRoute: string | undefined, href: string) => string
|
||||
defaultRoute?: string | undefined
|
||||
class?: string
|
||||
children?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
let {
|
||||
routes,
|
||||
currentRoute = undefined,
|
||||
isSelected = (url, currentRoute, route) =>
|
||||
(currentRoute ?? url.pathname) == route,
|
||||
buildUrl = (route, href) => href,
|
||||
defaultRoute = undefined,
|
||||
class: clazz = '',
|
||||
children,
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
<nav
|
||||
@@ -32,7 +41,7 @@
|
||||
>
|
||||
{#each routes as route}
|
||||
<a
|
||||
on:click={() => invalidate(route.href)}
|
||||
onclick={() => invalidate(route.href)}
|
||||
href={buildUrl(currentRoute, route.href)}
|
||||
class="font-medium rounded-full px-4 py-1 hover:bg-slate-200/40 hover:dark:bg-zinc-700/40
|
||||
transition-colors duration-100 relative z-0 flex-shrink-0"
|
||||
@@ -46,5 +55,5 @@
|
||||
{/if}
|
||||
</a>
|
||||
{/each}
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
</nav>
|
||||
Reference in new issue
Block a user