2019-08-19 22:18:23 +02:00
|
|
|
<script>
|
2019-08-27 08:32:56 +02:00
|
|
|
export let className = "default";
|
2019-08-19 22:18:23 +02:00
|
|
|
export let disabled = false;
|
2019-08-27 08:32:56 +02:00
|
|
|
export let contentText;
|
|
|
|
export let contentComponent;
|
|
|
|
|
2019-09-03 11:42:19 +02:00
|
|
|
export let _app;
|
|
|
|
let contentComponentContainer;
|
|
|
|
|
|
|
|
$:{
|
|
|
|
if(_app && contentComponentContainer)
|
|
|
|
_app.initialiseComponent(contentComponent, contentComponentContainer);
|
|
|
|
}
|
|
|
|
|
2019-08-19 22:18:23 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<button class={className} {disabled} on:click>
|
2019-08-27 08:32:56 +02:00
|
|
|
{#if contentComponent && contentComponent._component}
|
2019-09-03 11:42:19 +02:00
|
|
|
<div bind:this={contentComponentContainer}>
|
|
|
|
</div>
|
2019-08-27 08:32:56 +02:00
|
|
|
{:else if contentText}
|
2019-08-19 22:18:23 +02:00
|
|
|
{contentText}
|
|
|
|
{:else}
|
2019-08-27 08:32:56 +02:00
|
|
|
<slot />
|
2019-08-19 22:18:23 +02:00
|
|
|
{/if}
|
2019-08-27 08:32:56 +02:00
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
.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;
|
|
|
|
color: #333;
|
|
|
|
background-color: #f4f4f4;
|
|
|
|
outline: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.default:active {
|
|
|
|
background-color: #ddd;
|
|
|
|
}
|
|
|
|
|
|
|
|
.default:focus {
|
|
|
|
border-color: #666;
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|