spectrum button component, allow binding to queries
This commit is contained in:
parent
1a94ef5039
commit
9dc3725268
|
@ -135,6 +135,20 @@
|
||||||
"label": "Text",
|
"label": "Text",
|
||||||
"key": "text"
|
"key": "text"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "select",
|
||||||
|
"label": "Button Type",
|
||||||
|
"key": "type",
|
||||||
|
"options": ["primary", "secondary", "cta", "warning"],
|
||||||
|
"defaultValue": "primary"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "select",
|
||||||
|
"label": "Size",
|
||||||
|
"key": "size",
|
||||||
|
"options": ["S", "M", "L", "XL"],
|
||||||
|
"defaultValue": "M"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"label": "Disabled",
|
"label": "Disabled",
|
||||||
|
|
|
@ -7,31 +7,15 @@
|
||||||
export let disabled = false
|
export let disabled = false
|
||||||
export let text = ""
|
export let text = ""
|
||||||
export let onClick
|
export let onClick
|
||||||
|
export let size = "M"
|
||||||
|
export let type = "primary"
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
class="default"
|
class={`spectrum-Button spectrum-Button--size${size} spectrum-Button--${type}`}
|
||||||
disabled={disabled || false}
|
disabled={disabled || false}
|
||||||
use:styleable={$component.styles}
|
use:styleable={$component.styles}
|
||||||
on:click={onClick}
|
on:click={onClick}
|
||||||
>
|
>
|
||||||
{text || ""}
|
{text || ""}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<style>
|
|
||||||
.default {
|
|
||||||
align-items: center;
|
|
||||||
padding: var(--spacing-s) var(--spacing-l);
|
|
||||||
box-sizing: border-box;
|
|
||||||
border-radius: 4px;
|
|
||||||
outline: none;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.2s ease 0s;
|
|
||||||
overflow: hidden;
|
|
||||||
outline: none;
|
|
||||||
user-select: none;
|
|
||||||
white-space: nowrap;
|
|
||||||
text-align: center;
|
|
||||||
font-family: var(--font-sans);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
Loading…
Reference in New Issue