diff --git a/src/components/atoms/Button.svelte b/src/components/atoms/Button.svelte index 6c4f54f..c4f8916 100644 --- a/src/components/atoms/Button.svelte +++ b/src/components/atoms/Button.svelte @@ -19,14 +19,14 @@ className, effect ? effect : undefined, ...[color, size].map(variant => variant && `${className}--${variant}`), - $$slots ? `has-icon-${slotPosition}` : undefined, + Object.keys($$slots).length !== 0 ? `has-icon-${slotPosition}` : undefined, $$props.class ].join(' ').trim() // Define external links - let rel: string, target: string - $: isExternal = /(http(s?)):\/\//i.test(url) - $: rel = isExternal ? 'external noopener noreferrer' : null + $: isExternal = /^(http|https):\/\//i.test(url) + $: isProtocol = /^(mailto|tel):/i.test(url) + $: rel = isExternal ? 'external noopener' : null $: target = isExternal ? '_blank' : null @@ -43,9 +43,9 @@ {:else if tag === 'a'}