Optimize components
- Use class attribute over className - Code cleaning
This commit is contained in:
@@ -1,20 +1,19 @@
|
||||
<script>
|
||||
export let href = '#'
|
||||
export let type = 'a'
|
||||
export let className = 'button'
|
||||
export let text = ''
|
||||
|
||||
const hasSlot = arguments[1].$$slots !== undefined
|
||||
</script>
|
||||
|
||||
{#if type === 'button'}
|
||||
<button class={className} class:button-icon={hasSlot} data-text={text} on:click>
|
||||
<button class={$$props.class ? $$props.class : 'button'} class:button-icon={hasSlot} data-text={text} on:click>
|
||||
<slot></slot>
|
||||
<span>{text}</span>
|
||||
</button>
|
||||
|
||||
{:else}
|
||||
<a {href} class={className} class:button-icon={hasSlot} data-text={text} on:click>
|
||||
<a {href} class={$$props.class ? $$props.class : 'button'} class:button-icon={hasSlot} data-text={text} on:click>
|
||||
<slot></slot>
|
||||
<span>{text}</span>
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user