Fix Button styling

This commit is contained in:
2021-10-02 13:21:40 +02:00
parent 77c19ff43f
commit 25ef6b37d1
2 changed files with 11 additions and 7 deletions

View File

@@ -2,15 +2,20 @@
export let text: string
export let tag: string = 'a'
export let url: string = undefined
const classes = [
'button',
$$props.class
].join(' ')
</script>
{#if tag === 'button'}
<button class="button {$$props.class}">
<button class={classes}>
<slot />
{text}
</button>
{:else if tag === 'a'}
<a href={url} class="button {$$props.class}">
<a href={url} class={classes}>
<slot />
<span>{text}</span>
</a>