anki/ts/components/ButtonDropdown.svelte
Henrik Giesel 30bbbaf00b
Use eslint for sorting our imports (#1637)
* Make eslint sort our imports

* fix missing deps in eslint rule (dae)

Caught on Linux due to the stricter sandboxing

* Remove exports-last eslint rule (for now?)

* Adjust browserslist settings

- We use ResizeObserver which is not supported in browsers like KaiOS,
  Baidu or Android UC

* Raise minimum iOS version 13.4

- It's the first version that supports ResizeObserver

* Apply new eslint rules to sort imports
2022-02-04 18:36:34 +10:00

46 lines
1.1 KiB
Svelte

<!--
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="ts">
import { setContext } from "svelte";
import ButtonToolbar from "./ButtonToolbar.svelte";
import { dropdownKey } from "./context-keys";
export let id: string | undefined = undefined;
let className = "";
export { className as class };
setContext(dropdownKey, null);
</script>
<ButtonToolbar {id} class="dropdown-menu btn-dropdown-menu {className}" wrap={false}>
<div on:mousedown|preventDefault|stopPropagation on:click>
<slot />
</div>
</ButtonToolbar>
<style lang="scss">
div {
display: contents;
}
: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>