changing UIkit dropdown to use bbui popover

This commit is contained in:
Victoria Sloan 2020-09-06 22:58:47 +01:00
parent 4cb7191576
commit ac361705d4
1 changed files with 10 additions and 39 deletions

View File

@ -4,7 +4,6 @@
import { getComponentDefinition } from "builderStore/storeUtils" import { getComponentDefinition } from "builderStore/storeUtils"
import ConfirmDialog from "components/common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import { last, cloneDeep } from "lodash/fp" import { last, cloneDeep } from "lodash/fp"
import UIkit from "uikit"
import { import {
selectComponent, selectComponent,
getParent, getParent,
@ -13,20 +12,14 @@
regenerateCssForCurrentScreen, regenerateCssForCurrentScreen,
} from "builderStore/storeUtils" } from "builderStore/storeUtils"
import { uuid } from "builderStore/uuid" import { uuid } from "builderStore/uuid"
import { Popover } from "@budibase/bbui"
export let component export let component
let confirmDeleteDialog let confirmDeleteDialog
let dropdownEl let dropdown
$: dropdown = UIkit.dropdown(dropdownEl, { console.log("hisisis")
mode: "click",
offset: 0,
pos: "bottom-right",
"delay-hide": 0,
animation: false,
})
$: dropdown && UIkit.util.on(dropdown, "shown", () => (hidden = false))
$: noChildrenAllowed = $: noChildrenAllowed =
!component || !getComponentDefinition($store, component._component).children !component || !getComponentDefinition($store, component._component).children
$: noPaste = !$store.componentToPaste $: noPaste = !$store.componentToPaste
@ -119,7 +112,12 @@
<button> <button>
<MoreIcon /> <MoreIcon />
</button> </button>
<ul class="menu" bind:this={dropdownEl} on:click={hideDropdown}>
<Popover
class="menu"
bind:this={dropdown}
on:click={hideDropdown}
align="left">
<li class="item" on:click={() => confirmDeleteDialog.show()}> <li class="item" on:click={() => confirmDeleteDialog.show()}>
<i class="icon ri-delete-bin-2-line" /> <i class="icon ri-delete-bin-2-line" />
Delete Delete
@ -166,7 +164,7 @@
<i class="icon ri-insert-column-right" /> <i class="icon ri-insert-column-right" />
Paste inside Paste inside
</li> </li>
</ul> </Popover>
</div> </div>
<ConfirmDialog <ConfirmDialog
@ -192,23 +190,6 @@
outline: none; outline: none;
} }
.menu {
z-index: 100000;
overflow: visible;
padding: 12px 0px;
border-radius: 5px;
}
.menu li {
border-style: none;
background-color: transparent;
list-style-type: none;
padding: 4px 16px;
margin: 0;
width: 100%;
box-sizing: border-box;
}
.item { .item {
display: flex; display: flex;
align-items: center; align-items: center;
@ -219,16 +200,6 @@
margin-right: 8px; margin-right: 8px;
} }
.menu li:not(.disabled) {
cursor: pointer;
color: var(--grey-7);
}
.menu li:not(.disabled):hover {
color: var(--ink);
background-color: var(--grey-1);
}
.disabled { .disabled {
color: var(--grey-4); color: var(--grey-4);
cursor: default; cursor: default;