2021-03-29 21:05:30 +02:00
|
|
|
<script lang="typescript">
|
2021-03-29 23:26:08 +02:00
|
|
|
export let className: string = '';
|
2021-03-29 21:05:30 +02:00
|
|
|
export let onClick: (event: ClickEvent) => void;
|
2021-03-29 23:26:08 +02:00
|
|
|
export let active = false;
|
|
|
|
export let disabled = false;
|
2021-03-29 21:05:30 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
button {
|
|
|
|
display: inline-block;
|
2021-03-29 23:26:08 +02:00
|
|
|
|
2021-03-29 23:02:20 +02:00
|
|
|
width: 30px;
|
|
|
|
height: 30px;
|
2021-03-29 21:05:30 +02:00
|
|
|
|
2021-03-29 23:26:08 +02:00
|
|
|
background-color: white;
|
2021-03-29 21:05:30 +02:00
|
|
|
vertical-align: -webkit-baseline-middle;
|
|
|
|
|
|
|
|
& > :global(svg),
|
|
|
|
& > :global(img) {
|
|
|
|
vertical-align: unset;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
|
2021-03-29 23:02:20 +02:00
|
|
|
&:hover {
|
|
|
|
background-color: #eee;
|
|
|
|
}
|
2021-03-29 21:05:30 +02:00
|
|
|
|
2021-03-29 23:02:20 +02:00
|
|
|
&:active, &.active {
|
|
|
|
box-shadow: inset 0 0 10px 3px rgb(0 0 0 / 30%);
|
2021-03-29 21:05:30 +02:00
|
|
|
}
|
2021-03-29 23:26:08 +02:00
|
|
|
|
|
|
|
&[disabled] {
|
|
|
|
opacity: 0.4;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background-color: white;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:active, &.active {
|
|
|
|
box-shadow: none;
|
|
|
|
}
|
|
|
|
}
|
2021-03-29 21:05:30 +02:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
2021-03-29 23:26:08 +02:00
|
|
|
<button
|
|
|
|
class="p-1 {className}"
|
|
|
|
class:active
|
|
|
|
{disabled}
|
|
|
|
on:click={onClick}
|
|
|
|
on:mousedown|preventDefault
|
|
|
|
>
|
2021-03-29 21:05:30 +02:00
|
|
|
<slot />
|
|
|
|
</button>
|