Rethink buttons hover transitions

This commit is contained in:
2020-02-29 10:46:41 +01:00
parent 856fc66445
commit 631a3e6ccb
4 changed files with 55 additions and 55 deletions

View File

@@ -2,19 +2,21 @@
export let href = '#'
export let type = 'a'
export let text = ''
const hasSlot = arguments[1].$$slots !== undefined
</script>
{#if type === 'button'}
<button class={$$props.class ? $$props.class : 'button'} class:button-icon={hasSlot} data-text={text} on:click>
<button class={$$props.class ? $$props.class : 'button'} on:click>
<slot></slot>
<span>{text}</span>
<div class="text" data-text={text}>
<span>{text}</span>
</div>
</button>
{:else}
<a {href} class={$$props.class ? $$props.class : 'button'} class:button-icon={hasSlot} data-text={text} on:click>
<a {href} class={$$props.class ? $$props.class : 'button'} on:click>
<slot></slot>
<span>{text}</span>
<div class="text" data-text={text}>
<span>{text}</span>
</div>
</a>
{/if}