mirror of https://github.com/hykilpikonna/AquaDX
[F] Fix confirm overlay bind
parent
22fffcc422
commit
b2f10e31f7
|
@ -12,6 +12,11 @@
|
|||
export let confirm: ConfirmProps | null = null
|
||||
export let error: string | null
|
||||
export let loading: boolean = false
|
||||
|
||||
function doConfirm(fn: () => void) {
|
||||
confirm = null
|
||||
fn()
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if confirm}
|
||||
|
@ -22,15 +27,9 @@
|
|||
|
||||
<div class="actions">
|
||||
{#if confirm.cancel}
|
||||
<!-- Svelte LSP is very annoying here -->
|
||||
<button on:click={() => {
|
||||
confirm && confirm.cancel && confirm.cancel()
|
||||
|
||||
// Set to null
|
||||
confirm = null
|
||||
}}>{t('action.cancel')}</button>
|
||||
<button on:click={() => doConfirm(confirm!!.cancel!!)}>{t('action.cancel')}</button>
|
||||
{/if}
|
||||
<button on:click={() => confirm && confirm.confirm()} class:error={confirm.dangerous}>{t('action.confirm')}</button>
|
||||
<button on:click={() => doConfirm(confirm!!.confirm)} class:error={confirm.dangerous}>{t('action.confirm')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
defaultGame()
|
||||
</script>
|
||||
|
||||
<StatusOverlays {confirm} {error} />
|
||||
<StatusOverlays bind:confirm={confirm} {error} />
|
||||
|
||||
<main class="content">
|
||||
<div class="outer-title-options">
|
||||
|
|
Loading…
Reference in New Issue