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?.()}
|
{@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 />
|
||||||
|
|||||||
@@ -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},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user