<script lang="ts">
    export let text: string
    export let tag: string = 'a'
    export let url: string = undefined
    export let disabled: boolean = undefined

    const classes = [
        'button',
        $$props.class
    ].join(' ').trim()
</script>

{#if tag === 'button'}
    <button class={classes} on:click disabled={disabled}>
        <slot />
        {text}
    </button>
{:else if tag === 'a'}
    <a href={url} class={classes} on:click sveltekit:prefetch>
        <slot />
        <span>{text}</span>
    </a>
{/if}