Fix more stuff, particularly event handlers

This commit is contained in:
Jon Staab
2025-02-03 17:21:46 -08:00
parent 8d3433b167
commit 24045a7e2a
150 changed files with 424 additions and 392 deletions
+17 -8
View File
@@ -1,13 +1,22 @@
<script lang="ts">
import type {Snippet} from "svelte"
import {stopPropagation} from "svelte/legacy"
import {goto} from "$app/navigation"
interface Props {
const {
children,
href,
external = false,
replaceState = false,
...restProps
}: {
children: Snippet
href: string
external: boolean
replaceState: boolean
}
let {href, external = false, replaceState = false, ...restProps} = $props()
external?: boolean
replaceState?: boolean
disabled?: boolean
class?: string
} = $props()
const go = (e: Event) => {
if (!external) {
@@ -21,9 +30,9 @@
<a
{href}
{...restProps}
on:click|stopPropagation={go}
onclick={stopPropagation(go)}
class="cursor-pointer {restProps.class}"
rel={external ? "noopener noreferer" : ""}
target={external ? "_blank" : ""}>
<slot />
{@render children?.()}
</a>