Hide close button in dialog if in a noEscape modal

This commit is contained in:
Jon Staab
2026-03-17 14:55:40 -07:00
parent 368f0b048b
commit 58a6be911a
3 changed files with 11 additions and 7 deletions
+1 -1
View File
@@ -20,7 +20,7 @@
{@render children?.()} {@render children?.()}
</PrimaryNav> </PrimaryNav>
{:else if !$modal} {:else if !$modal}
<Dialog children={{component: Landing, props: {}}} /> <Dialog noEscape children={{component: Landing, props: {}}} />
{/if} {/if}
</div> </div>
<Toast /> <Toast />
+1
View File
@@ -42,6 +42,7 @@
target: element, target: element,
props: { props: {
onClose: closeModal, onClose: closeModal,
noEscape: options.noEscape,
fullscreen: options.fullscreen, fullscreen: options.fullscreen,
children: {component, props}, children: {component, props},
}, },
+9 -6
View File
@@ -10,6 +10,7 @@
type Props = { type Props = {
onClose?: any onClose?: any
noEscape?: boolean
fullscreen?: boolean fullscreen?: boolean
children: { children: {
component: Component<any> component: Component<any>
@@ -17,7 +18,7 @@
} }
} }
const {onClose = noop, fullscreen = false, children}: Props = $props() const {onClose = noop, noEscape = false, fullscreen = false, children}: Props = $props()
const wrapperClass = $derived( const wrapperClass = $derived(
cx("absolute inset-0 flex sm:relative pointer-events-none", { cx("absolute inset-0 flex sm:relative pointer-events-none", {
@@ -47,11 +48,13 @@
</button> </button>
<div class={wrapperClass}> <div class={wrapperClass}>
<div class={innerClass} transition:fly> <div class={innerClass} transition:fly>
<Button {#if !noEscape}
class="absolute -top-4 right-3 btn btn-circle btn-neutral btn-sm" <Button
onclick={clearModals}> class="absolute -top-4 right-3 btn btn-circle btn-neutral btn-sm"
<Icon icon={Close} size={6} /> onclick={clearModals}>
</Button> <Icon icon={Close} size={6} />
</Button>
{/if}
<children.component {...children.props} /> <children.component {...children.props} />
</div> </div>
</div> </div>