Add ButtonDropdown for dropdowns like the MathJax dropdown on AnkiMobile
This commit is contained in:
parent
6953389798
commit
9cbab08b00
16
ts/editor-toolbar/ButtonDropdown.svelte
Normal file
16
ts/editor-toolbar/ButtonDropdown.svelte
Normal 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} />
|
@ -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)}
|
||||
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user