Anki/ts/editor-toolbar/InnerButton.svelte
2021-04-15 13:09:49 +02:00

62 lines
1.2 KiB
Svelte

<script lang="typescript">
export let className: string = "";
export let onClick: (event: ClickEvent) => void;
export let active = false;
export let disabled = false;
</script>
<style lang="scss">
button {
display: inline-block;
vertical-align: middle;
width: 28px;
height: 28px;
background-color: white;
& > :global(svg),
& > :global(img) {
vertical-align: unset;
width: 100%;
height: 100%;
}
&:hover {
background-color: #eee;
}
&:active,
&.active {
box-shadow: inset 0 0 12px 4px rgb(0 0 0 / 30%);
border-color: #aaa;
}
&.active:active {
box-shadow: none;
border-color: var(--border);
}
&[disabled] {
opacity: 0.4;
&:hover {
background-color: white;
}
&:active,
&.active {
box-shadow: none;
}
}
}
</style>
<button
class="p-1 {className}"
class:active
tabindex="-1"
{disabled}
on:click={onClick}
on:mousedown|preventDefault>
<slot />
</button>