2021-03-29 21:05:30 +02:00
|
|
|
<script lang="typescript">
|
2021-03-29 23:43:48 +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:43:48 +02:00
|
|
|
vertical-align: middle;
|
2021-03-30 02:39:54 +02:00
|
|
|
width: 28px;
|
|
|
|
height: 28px;
|
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
|
|
|
|
|
|
|
& > :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:43:48 +02:00
|
|
|
&:active,
|
|
|
|
&.active {
|
2021-03-29 23:02:20 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2021-03-29 23:43:48 +02:00
|
|
|
&:active,
|
|
|
|
&.active {
|
2021-03-29 23:26:08 +02:00
|
|
|
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
|
2021-03-30 03:05:21 +02:00
|
|
|
tabindex="-1"
|
2021-03-29 23:26:08 +02:00
|
|
|
{disabled}
|
|
|
|
on:click={onClick}
|
2021-03-29 23:43:48 +02:00
|
|
|
on:mousedown|preventDefault>
|
2021-03-29 21:05:30 +02:00
|
|
|
<slot />
|
|
|
|
</button>
|