2021-03-31 22:59:07 +13:00
|
|
|
<script>
|
2021-04-09 03:04:27 +12: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"
|
|
|
|
|
|
|
|
export let icon = undefined;
|
2021-03-31 22:59:07 +13:00
|
|
|
</script>
|
|
|
|
|
2021-04-09 03:04:27 +12:00
|
|
|
|
2021-03-31 22:59:07 +13:00
|
|
|
{#if href}
|
|
|
|
<a
|
2021-04-09 03:04:27 +12:00
|
|
|
class="spectrum-Button spectrum-Button--{type} spectrum-Button--size{size.toUpperCase()}"
|
2021-03-31 22:59:07 +13:00
|
|
|
{href}
|
|
|
|
{disabled}>
|
2021-04-09 03:04:27 +12:00
|
|
|
{#if icon}
|
|
|
|
<svg class="spectrum-Icon spectrum-Icon--sizeS" focusable="false" aria-hidden="true" aria-label="{icon}">
|
|
|
|
<use xlink:href="#spectrum-icon-18-{icon}" />
|
|
|
|
</svg>
|
|
|
|
{/if}
|
|
|
|
<span class="spectrum-Button-label"><slot /></span>
|
2021-03-31 22:59:07 +13:00
|
|
|
</a>
|
|
|
|
{:else}
|
|
|
|
<button
|
2021-04-09 03:04:27 +12:00
|
|
|
class="spectrum-Button spectrum-Button--{type} spectrum-Button--size{size.toUpperCase()}"
|
2021-03-31 22:59:07 +13:00
|
|
|
{disabled}
|
|
|
|
on:click|preventDefault>
|
2021-04-09 03:04:27 +12:00
|
|
|
{#if icon}
|
|
|
|
<svg class="spectrum-Icon spectrum-Icon--sizeM" focusable="false" aria-hidden="true" aria-label="{icon}">
|
|
|
|
<use xlink:href="#spectrum-icon-18-{icon}" />
|
|
|
|
</svg>
|
|
|
|
{/if}
|
|
|
|
<span class="spectrum-Button-label"><slot /></span>
|
2021-03-31 22:59:07 +13:00
|
|
|
</button>
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
</style>
|