upend/webui/src/components/utils/IconButton.svelte

52 lines
886 B
Svelte
Raw Normal View History

<script lang="ts">
import Icon from "./Icon.svelte";
export let name: string;
export let active = false;
export let disabled = false;
export let title: string | undefined = undefined;
</script>
<button on:click class:active {disabled} {title}>
<Icon {name} />
2023-04-23 13:14:36 +02:00
<div class="text">
<slot />
</div>
</button>
<style lang="scss">
button {
2023-04-23 13:14:36 +02:00
display: flex;
flex-direction: column;
align-items: center;
border: 0;
background: transparent;
cursor: pointer;
color: inherit;
opacity: 0.66;
2022-01-03 22:31:51 +01:00
display: flex;
align-items: center;
transition: opacity 0.2s, color 0.2s;
}
.active,
button:hover {
opacity: 1;
2021-12-30 23:24:38 +01:00
color: var(--active-color, var(--primary));
}
2022-01-27 17:35:58 +01:00
button:disabled {
color: gray;
pointer-events: none;
}
2023-04-23 13:14:36 +02:00
.text {
2023-06-19 11:48:58 +02:00
font-size: 0.5em;
2023-04-23 13:14:36 +02:00
text-align: center;
margin-top: 0.2em;
}
</style>