anki/ts/editor-toolbar/IconButtonInner.svelte

36 lines
778 B
Svelte
Raw Normal View History

2021-03-29 21:05:30 +02:00
<script lang="typescript">
export let className: string;
export let onClick: (event: ClickEvent) => void;
export let active: boolean;
</script>
<style lang="scss">
button {
display: inline-block;
2021-03-29 23:02:20 +02:00
width: 30px;
height: 30px;
2021-03-29 21:05:30 +02:00
vertical-align: -webkit-baseline-middle;
padding: 2px;
& > :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
}
}
</style>
<button class={className} class:active on:click={onClick} on:mousedown|preventDefault>
<slot />
</button>