2021-03-31 11:59:07 +02:00
|
|
|
<script>
|
2021-04-08 17:04:27 +02:00
|
|
|
import "@spectrum-css/button/dist/index-vars.css"
|
|
|
|
|
|
|
|
export let href = false
|
|
|
|
export let disabled = false
|
|
|
|
|
|
|
|
/** @type {('S', 'M', 'L', 'XL')} Size of button */
|
|
|
|
export let size = "M";
|
|
|
|
/** @type {('cta','primary','secondary','warning', 'overBackground')} Type of button */
|
|
|
|
export let type = "primary"
|
2021-04-08 18:04:03 +02:00
|
|
|
|
|
|
|
export let quiet = false
|
2021-04-08 17:04:27 +02:00
|
|
|
|
|
|
|
export let icon = undefined;
|
2021-03-31 11:59:07 +02:00
|
|
|
</script>
|
|
|
|
|
2021-04-08 17:04:27 +02:00
|
|
|
|
2021-03-31 11:59:07 +02:00
|
|
|
{#if href}
|
|
|
|
<a
|
2021-04-08 17:04:27 +02:00
|
|
|
class="spectrum-Button spectrum-Button--{type} spectrum-Button--size{size.toUpperCase()}"
|
2021-03-31 11:59:07 +02:00
|
|
|
{href}
|
|
|
|
{disabled}>
|
2021-04-08 17:04:27 +02:00
|
|
|
{#if icon}
|
2021-04-08 18:04:03 +02:00
|
|
|
<svg class="spectrum-Icon spectrum-Icon--size{size.toUpperCase()}" focusable="false" aria-hidden="true" aria-label="{icon}">
|
2021-04-08 17:04:27 +02:00
|
|
|
<use xlink:href="#spectrum-icon-18-{icon}" />
|
|
|
|
</svg>
|
|
|
|
{/if}
|
|
|
|
<span class="spectrum-Button-label"><slot /></span>
|
2021-03-31 11:59:07 +02:00
|
|
|
</a>
|
|
|
|
{:else}
|
|
|
|
<button
|
2021-04-08 18:04:03 +02:00
|
|
|
class="spectrum-Button spectrum-Button--{type} spectrum-Button--size{size.toUpperCase()} {quiet && 'spectrum-Button--quiet'}"
|
2021-03-31 11:59:07 +02:00
|
|
|
{disabled}
|
|
|
|
on:click|preventDefault>
|
2021-04-08 17:04:27 +02:00
|
|
|
{#if icon}
|
2021-04-08 18:04:03 +02:00
|
|
|
<svg class="spectrum-Icon spectrum-Icon--size{size.toUpperCase()}" focusable="false" aria-hidden="true" aria-label="{icon}">
|
2021-04-08 17:04:27 +02:00
|
|
|
<use xlink:href="#spectrum-icon-18-{icon}" />
|
|
|
|
</svg>
|
|
|
|
{/if}
|
2021-04-09 11:10:37 +02:00
|
|
|
{#if $$slots}
|
|
|
|
<span class="spectrum-Button-label"><slot /></span>
|
|
|
|
{/if}
|
2021-03-31 11:59:07 +02:00
|
|
|
</button>
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
</style>
|