anki/ts/editor-toolbar/DropdownMenu.svelte

36 lines
876 B
Svelte
Raw Normal View History

2021-04-15 15:59: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">
2021-04-24 00:00:32 +02:00
import type { ToolbarItem } from "./types";
import { getContext } from "svelte";
import { nightModeKey } from "./contextKeys";
2021-03-31 03:34:08 +02:00
export let id: string;
export let items: ToolbarItem[];
const nightMode = getContext<boolean>(nightModeKey);
</script>
<style lang="scss">
@use 'ts/sass/button_mixins' as button;
ul {
background-color: white;
border-color: var(--medium-border);
}
.night-mode {
background-color: var(--bg-color);
}
</style>
<ul {id} class="dropdown-menu" class:night-mode={nightMode}>
{#each items as menuItem}
<li>
<svelte:component this={menuItem.component} {...menuItem} />
2021-03-31 03:34:08 +02:00
</li>
{/each}
</ul>