Add ButtonDropdown for dropdowns like the MathJax dropdown on AnkiMobile

This commit is contained in:
Henrik Giesel 2021-04-01 16:29:24 +02:00
parent 6953389798
commit 9cbab08b00
3 changed files with 22 additions and 1 deletions

View File

@ -0,0 +1,16 @@
<script lang="typescript">
import type { Buttons } from "./types";
import ButtonGroup from "./ButtonGroup.svelte";
export let id = "";
export let className = "";
export let props: Record<string, string> = {};
function extendClassName(className: string): string {
return `dropdown-menu bg-transparent border-0 ${className}`;
}
export let buttons: Buttons;
</script>
<ButtonGroup {id} className={extendClassName(className)} {props} {buttons} />

View File

@ -1,6 +1,10 @@
<script lang="typescript">
import type { Buttons } from "./types";
export let id = "";
export let className = "";
export let props: Record<string, string> = {};
export let buttons: Buttons;
</script>
@ -47,7 +51,7 @@
}
</style>
<ul>
<ul {id} class={className} {...props}>
{#each buttons as button}
<li>
{#if Array.isArray(button)}

View File

@ -64,4 +64,5 @@ export { default as SelectButton } from "./SelectButton.svelte";
export { default as DropdownMenu } from "./DropdownMenu.svelte";
export { default as DropdownItem } from "./DropdownItem.svelte";
export { default as ButtonDropdown } from "./DropdownMenu.svelte";
export { default as WithDropdownMenu } from "./WithDropdownMenu.svelte";