1
0
Fork 0
mirror of synced 2024-10-03 02:27:06 +13:00

Add external setting for links

This commit is contained in:
Andrew Kingston 2021-02-26 09:58:24 +00:00
parent 624ad79c95
commit 0988f27f15

View file

@ -7,11 +7,19 @@
export let url = ""
export let text = ""
export let openInNewTab = false
export let external = false
$: target = openInNewTab ? "_blank" : "_self"
</script>
<a href={url || '/'} use:linkable {target} use:styleable={$component.styles}>
{#if external}
<a href={url || '/'} {target} use:styleable={$component.styles}>
{text}
<slot />
</a>
</a>
{:else}
<a href={url || '/'} use:linkable {target} use:styleable={$component.styles}>
{text}
<slot />
</a>
{/if}