forked from coracle/flotilla
Hide close button in dialog if in a noEscape modal
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
{@render children?.()}
|
||||
</PrimaryNav>
|
||||
{:else if !$modal}
|
||||
<Dialog children={{component: Landing, props: {}}} />
|
||||
<Dialog noEscape children={{component: Landing, props: {}}} />
|
||||
{/if}
|
||||
</div>
|
||||
<Toast />
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
target: element,
|
||||
props: {
|
||||
onClose: closeModal,
|
||||
noEscape: options.noEscape,
|
||||
fullscreen: options.fullscreen,
|
||||
children: {component, props},
|
||||
},
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
type Props = {
|
||||
onClose?: any
|
||||
noEscape?: boolean
|
||||
fullscreen?: boolean
|
||||
children: {
|
||||
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(
|
||||
cx("absolute inset-0 flex sm:relative pointer-events-none", {
|
||||
@@ -47,11 +48,13 @@
|
||||
</button>
|
||||
<div class={wrapperClass}>
|
||||
<div class={innerClass} transition:fly>
|
||||
<Button
|
||||
class="absolute -top-4 right-3 btn btn-circle btn-neutral btn-sm"
|
||||
onclick={clearModals}>
|
||||
<Icon icon={Close} size={6} />
|
||||
</Button>
|
||||
{#if !noEscape}
|
||||
<Button
|
||||
class="absolute -top-4 right-3 btn btn-circle btn-neutral btn-sm"
|
||||
onclick={clearModals}>
|
||||
<Icon icon={Close} size={6} />
|
||||
</Button>
|
||||
{/if}
|
||||
<children.component {...children.props} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user