anki/ts/components/WithLabel.svelte

28 lines
663 B
Svelte
Raw Normal View History

2021-04-23 17:20:52 +02:00
<!--
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="typescript">
import type { ToolbarItem } from "./types";
2021-04-24 00:00:32 +02:00
export let id: string;
export let className = "";
2021-04-23 17:20:52 +02:00
export let label: string;
2021-04-24 00:00:32 +02:00
export let button: ToolbarItem;
2021-04-23 17:20:52 +02:00
</script>
<!-- svelte-ignore a11y-label-has-associated-control -->
2021-04-24 00:00:32 +02:00
<label {id} class={className}>
<span class="me-1">{label}</span>
2021-04-23 17:20:52 +02:00
<svelte:component this={button.component} {...button} />
</label>
<style lang="scss">
label {
display: flex;
padding: 0 calc(var(--toolbar-size) / 10);
}
</style>