Skip to content

Commit

Permalink
Click anywhere to dimiss Modal
Browse files Browse the repository at this point in the history
  • Loading branch information
AguzzTN54 committed Feb 13, 2023
1 parent b707eec commit 90753cb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
9 changes: 6 additions & 3 deletions src/lib/components/shop/Donate.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
let showCryptoModal = false;
let showToast = false;
let dimiss = () => {
showCryptoModal = false;
};
const copyHandle = (text) => {
playSfx();
copy(text);
Expand All @@ -33,9 +37,8 @@
button="confirm"
show={showCryptoModal}
title="Support With Crypto"
on:confirm={() => {
showCryptoModal = false;
}}
on:confirm={dimiss}
on:cancel={dimiss}
>
<div class="modal-donate">
<div class="pop-item">
Expand Down
6 changes: 5 additions & 1 deletion src/lib/components/shop/PaymentModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
playSfx('close');
};
const dimiss = () => {
dispatch('cancel');
};
const convertToPrimogem = () => {
const afterBuy = $primogem + qty + bonus;
primogem.set(afterBuy);
Expand All @@ -39,7 +43,7 @@
};
</script>

<Modal {show} confirm={false} sfx={false}>
<Modal {show} confirm={false} sfx={false} on:cancel={dimiss}>
<Funds />
<div class="genesis-modal">
<div class="header">
Expand Down
13 changes: 11 additions & 2 deletions src/lib/components/utility/ModalTpl.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,20 @@
dispatch('cancel');
if (sfx) playSfx();
};
const dimiss = () => {
dispatch('cancel');
};
</script>

{#if show}
<div class="modal" transition:fade={{ duration: 80 }} style="height: {$viewportHeight}px;">
<div class="modal-content">
<div
class="modal"
transition:fade={{ duration: 80 }}
style="height: {$viewportHeight}px;"
on:click={dimiss}
>
<div class="modal-content" on:click|stopPropagation>
<span class="corner top-left" />
<span class="corner top-right" />
<span class="corner bottom-left" />
Expand Down

0 comments on commit 90753cb

Please sign in to comment.