anki/ts/components/ButtonDropdown.svelte
Henrik Giesel 358794c911 Uniformly use variables to Button{Toolbar,Group} for setting button properties
Instead of using WithTheming around ButtonToolbar/ButtonGroup
2021-05-27 17:13:36 +02:00

47 lines
1.0 KiB
Svelte

<!--
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="typescript">
import { setContext } from "svelte";
import { dropdownKey } from "./contextKeys";
import ButtonToolbar from "./ButtonToolbar.svelte";
export let id: string;
let className = "";
export { className as class };
export let api: Record<string, unknown> | undefined = undefined;
setContext(dropdownKey, null);
</script>
<ButtonToolbar
{id}
class={`dropdown-menu btn-dropdown-menu ${className}`}
wrap={false}
{api}
>
<slot />
</ButtonToolbar>
<style lang="scss">
:global(.dropdown-menu.btn-dropdown-menu) {
display: none;
min-width: 0;
padding: calc(var(--buttons-size) / 10) 0;
background-color: var(--window-bg);
border-color: var(--medium-border);
:global(.btn-group) {
position: static;
}
}
:global(.dropdown-menu.btn-dropdown-menu.show) {
display: flex;
}
</style>