Screen dropdown manu uses bbui dropdown menu

This commit is contained in:
Michael Shanks 2020-07-21 20:49:52 +01:00
parent bac8249132
commit 218699ddb8
2 changed files with 15 additions and 18 deletions

View File

@ -55,7 +55,7 @@
] ]
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "^1.15.8", "@budibase/bbui": "^1.16.0",
"@budibase/client": "^0.1.1", "@budibase/client": "^0.1.1",
"@budibase/colorpicker": "^1.0.1", "@budibase/colorpicker": "^1.0.1",
"@nx-js/compiler-util": "^2.0.0", "@nx-js/compiler-util": "^2.0.0",

View File

@ -4,20 +4,14 @@
import ConfirmDialog from "components/common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import UIkit from "uikit" import UIkit from "uikit"
import api from "builderStore/api" import api from "builderStore/api"
import Portal from "svelte-portal"
import { DropdownMenu } from "@budibase/bbui"
export let screen export let screen
let confirmDeleteDialog let confirmDeleteDialog
let dropdownEl let dropdown
let buttonForDropdown
$: dropdown = UIkit.dropdown(dropdownEl, {
mode: "click",
offset: 0,
pos: "bottom-right",
"delay-hide": 0,
animation: false,
})
$: dropdown && UIkit.util.on(dropdown, "shown", () => (hidden = false))
const hideDropdown = () => { const hideDropdown = () => {
dropdown.hide() dropdown.hide()
@ -42,15 +36,17 @@
</script> </script>
<div class="root boundary" on:click|stopPropagation={() => {}}> <div class="root boundary" on:click|stopPropagation={() => {}}>
<button> <button on:click={() => dropdown.show()} bind:this={buttonForDropdown}>
<MoreIcon /> <MoreIcon />
</button> </button>
<ul class="menu" bind:this={dropdownEl} on:click={hideDropdown}> <DropdownMenu bind:this={dropdown} anchor={buttonForDropdown}>
<li class="item" on:click={() => confirmDeleteDialog.show()}> <ul class="menu" on:click={hideDropdown}>
<i class="icon ri-delete-bin-2-line" /> <li class="item" on:click={() => confirmDeleteDialog.show()}>
Delete <i class="icon ri-delete-bin-2-line" />
</li> Delete
</ul> </li>
</ul>
</DropdownMenu>
</div> </div>
<ConfirmDialog <ConfirmDialog
@ -81,6 +77,7 @@
overflow: visible; overflow: visible;
padding: 12px 0px; padding: 12px 0px;
border-radius: 5px; border-radius: 5px;
margin: 0;
} }
.menu li { .menu li {