Button: Fix the spacing with an icon
This commit is contained in:
@@ -4,20 +4,17 @@
|
||||
export let className = 'button'
|
||||
export let text = ''
|
||||
|
||||
// Wrap string's each letters into a span
|
||||
// const textSpans = text
|
||||
// .replace(/(<.*?>)|(.)/g, letter => letter.replace(/./g, '<span>$&</span>'))
|
||||
// .replace(/ /g, '\u00a0')
|
||||
const hasSlot = arguments[1].$$slots !== undefined
|
||||
</script>
|
||||
|
||||
{#if type === 'button'}
|
||||
<button class={className} data-text={text}>
|
||||
<button class={className} class:button-icon={hasSlot} data-text={text}>
|
||||
<slot></slot>
|
||||
<span>{text}</span>
|
||||
</button>
|
||||
|
||||
{:else}
|
||||
<a {href} class={className} data-text={text}>
|
||||
<a {href} class={className} class:button-icon={hasSlot} data-text={text}>
|
||||
<slot></slot>
|
||||
<span>{text}</span>
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user