add closeOnClick slot prop to ActionMenu

This commit is contained in:
Keviin Åberg Kultalahti 2021-04-26 14:14:05 +02:00
parent 7f70fa3c0b
commit 2b394eab25
1 changed files with 6 additions and 1 deletions

View File

@ -16,6 +16,11 @@
export const show = () => { export const show = () => {
dropdown.show() dropdown.show()
} }
const closeOnClickWrapper = (cb) => {
dropdown.hide()
cb()
}
</script> </script>
<div class="contents" use:getAnchor on:click={dropdown.show}> <div class="contents" use:getAnchor on:click={dropdown.show}>
@ -23,7 +28,7 @@
</div> </div>
<Popover bind:this={dropdown} {anchor} align="left"> <Popover bind:this={dropdown} {anchor} align="left">
<Menu> <Menu>
<slot /> <slot closeOnClick={closeOnClickWrapper} />
</Menu> </Menu>
</Popover> </Popover>