Fix external links, people item note links

This commit is contained in:
Jon Staab
2024-10-15 12:17:02 -07:00
parent 9e944b62aa
commit 681e4356c4
2 changed files with 16 additions and 6 deletions
+8 -2
View File
@@ -4,14 +4,20 @@
export let href
export let external = false
const go = () => goto(href)
const go = (e: Event) => {
if (!external) {
e.preventDefault()
goto(href)
}
}
</script>
<a
{href}
{...$$props}
on:click|stopPropagation={go}
class="cursor-pointer {$$props.class}"
on:click|preventDefault|stopPropagation={go}
rel={external ? "noopener noreferer" : ""}
target={external ? "_blank" : ""}>
<slot />