1
0
Fork 0
mirror of synced 2024-09-08 21:51:58 +12:00
budibase/packages/standard-components/src/Button.svelte

73 lines
1.2 KiB
Svelte
Raw Normal View History

2019-08-20 08:18:23 +12:00
<script>
2020-02-03 22:50:30 +13:00
export let className = "default"
export let disabled = false
2020-05-09 07:29:15 +12:00
export let text
2020-02-03 22:50:30 +13:00
export let onClick
export let _bb
let theButton
2020-02-26 04:21:23 +13:00
$: if (_bb.props._children && _bb.props._children.length > 0)
theButton && _bb.attachChildren(theButton)
2020-02-03 22:50:30 +13:00
const clickHandler = () => {
_bb.call(onClick)
}
2019-08-20 08:18:23 +12:00
</script>
2020-02-03 22:50:30 +13:00
<button
bind:this={theButton}
class="{className}
disabled={disabled || false}
on:click={clickHandler}>
{#if !_bb.props._children || _bb.props._children.length === 0}
{text}
{/if}
2019-08-27 18:32:56 +12:00
</button>
<style>
2020-02-03 22:50:30 +13:00
.default {
font-family: inherit;
font-size: inherit;
padding: 0.4em;
margin: 0 0 0.5em 0;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 2px;
2020-03-18 00:16:49 +13:00
color: #000333;
2020-02-03 22:50:30 +13:00
outline: none;
}
.default:active {
2020-03-18 00:16:49 +13:00
background-color: #f9f9f9;
2020-02-03 22:50:30 +13:00
}
.default:focus {
border-color: #666;
}
.border {
border: var(--border);
}
.color {
color: var(--color);
}
.background {
background: var(--background);
}
.hoverBorder:hover {
border: var(--hoverBorder);
}
.hoverColor:hover {
color: var(--hoverColor);
}
.hoverBack:hover {
background: var(--hoverBackground);
}
</style>