anki/ts/editor-toolbar/InnerButton.svelte

57 lines
1.1 KiB
Svelte
Raw Normal View History

2021-03-29 21:05:30 +02:00
<script lang="typescript">
export let className: string = "";
2021-03-29 21:05:30 +02:00
export let onClick: (event: ClickEvent) => void;
export let active = false;
export let disabled = false;
2021-03-29 21:05:30 +02:00
</script>
<style lang="scss">
button {
display: inline-block;
vertical-align: middle;
width: 28px;
height: 28px;
2021-03-29 21:05:30 +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
&: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
}
&[disabled] {
opacity: 0.4;
&:hover {
background-color: white;
}
&:active,
&.active {
box-shadow: none;
}
}
2021-03-29 21:05:30 +02:00
}
</style>
<button
class="p-1 {className}"
class:active
2021-03-30 03:05:21 +02:00
tabindex="-1"
{disabled}
on:click={onClick}
on:mousedown|preventDefault>
2021-03-29 21:05:30 +02:00
<slot />
</button>