Allow nested modals

This commit is contained in:
Jon Staab
2026-03-11 16:29:24 -07:00
parent bfc997ba37
commit 19f532c12e
4 changed files with 59 additions and 34 deletions
+3 -15
View File
@@ -3,16 +3,16 @@
import {between, throttle} from "@welshman/lib"
import {isMobile} from "@lib/html"
import Button from "@lib/components/Button.svelte"
import Dialog from "@lib/components/Dialog.svelte"
import Tippy from "@lib/components/Tippy.svelte"
import IconPickerModal from "@app/components/IconPickerModal.svelte"
import IconPickerPopover from "@app/components/IconPickerPopover.svelte"
import {pushModal, popModal} from "@app/util/modal"
const {...props} = $props()
const open = () => {
if (isMobile) {
showIconPicker = true
pushModal(IconPickerModal, {onSelect: onClick}, {nested: true})
} else {
popover?.show()
}
@@ -20,7 +20,7 @@
const close = () => {
if (isMobile) {
showIconPicker = false
popModal()
} else {
popover?.hide()
}
@@ -41,7 +41,6 @@
}
})
let showIconPicker = $state(false)
let popover: Instance | undefined = $state()
</script>
@@ -56,14 +55,3 @@
{@render props.children?.()}
</Button>
</Tippy>
{#if showIconPicker}
<Dialog
onClose={close}
children={{
component: IconPickerModal,
props: {
onSelect: onClick,
},
}} />
{/if}