2024-06-17 21:17:27 +01:00
|
|
|
<script>
|
|
|
|
import { play_sound } from '../sound.js';
|
|
|
|
|
|
|
|
export let icon = "🔧";
|
|
|
|
export let type = "action";
|
|
|
|
export let label = "Action";
|
|
|
|
export let title = label;
|
|
|
|
export let count = 0;
|
|
|
|
export let sound = "default";
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
class="{type}"
|
|
|
|
aria-label="{label}"
|
|
|
|
title="{title}"
|
|
|
|
on:click={() => (play_sound(sound))}>
|
2024-06-19 22:13:16 +01:00
|
|
|
<span class="icon">{@html icon}</span>
|
2024-06-17 21:17:27 +01:00
|
|
|
{#if count}
|
|
|
|
<span class="count">{count}</span>
|
|
|
|
{/if}
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
button {
|
2024-06-19 22:13:16 +01:00
|
|
|
height: 32px;
|
2024-06-17 21:17:27 +01:00
|
|
|
padding: 6px 8px;
|
2024-06-19 22:13:16 +01:00
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
gap: 4px;
|
2024-06-17 21:17:27 +01:00
|
|
|
font-size: 1em;
|
|
|
|
background: none;
|
|
|
|
color: inherit;
|
|
|
|
border: none;
|
|
|
|
border-radius: 8px;
|
|
|
|
}
|
|
|
|
|
|
|
|
button.active {
|
|
|
|
background: var(--accent);
|
|
|
|
color: var(--bg0);
|
|
|
|
}
|
|
|
|
|
|
|
|
button:hover {
|
|
|
|
background: #8881;
|
|
|
|
}
|
|
|
|
|
|
|
|
button:active {
|
|
|
|
background: #0001;
|
|
|
|
}
|
|
|
|
|
2024-06-19 22:13:16 +01:00
|
|
|
.icon {
|
|
|
|
width: 20px;
|
|
|
|
height: 20px;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
2024-06-17 21:17:27 +01:00
|
|
|
.count {
|
|
|
|
opacity: .5;
|
|
|
|
}
|
|
|
|
|
|
|
|
button:hover .count {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
</style>
|