aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Success.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/Success.svelte')
-rw-r--r--src/components/Success.svelte62
1 files changed, 35 insertions, 27 deletions
diff --git a/src/components/Success.svelte b/src/components/Success.svelte
index b2e126b3..d7561081 100644
--- a/src/components/Success.svelte
+++ b/src/components/Success.svelte
@@ -2,9 +2,9 @@
import { browser } from "$app/environment";
import { scale } from "svelte/transition";
import Amount from "$comp/Amount.svelte";
- import { Confetti } from "svelte-confetti";
const { amount, tip, rate, currency, locale, title } = $props();
+ let ConfettiComp = $state(null);
let loaded = $state(false);
$effect(() => {
if (browser)
@@ -12,38 +12,46 @@
loaded = true;
});
});
+
+ $effect(async () => {
+ if (!browser || !loaded || ConfettiComp) return;
+ const mod = await import("svelte-confetti");
+ ConfettiComp = mod.Confetti;
+ });
</script>
<div class="text-center mt-20 md:mt-0">
{#if loaded}
<div class="relative flex justify-center">
<div class="absolute top-64 pointer-events-none">
- <Confetti
- amount="20"
- size="40"
- duration="1600"
- delay={[0, 500]}
- fallDistance="50px"
- colorArray={["url(/images/bolt.svg)"]}
- />
- <Confetti
- amount="40"
- delay={[0, 500]}
- size="15"
- fallDistance="50px"
- duration="1600"
- colorArray={[
- "#FFD700", // Gold
- "#FF6F61", // Coral
- "#6BCB77", // Mint green
- "#4D96FF", // Light blue
- "#FF9CEE", // Light pink
- "#FFD580", // Soft orange
- "#87CEEB", // Sky blue
- "#FFB6C1", // Light coral pink
- "#C1C7FF", // Lavender
- ]}
- />
+ {#if ConfettiComp}
+ <ConfettiComp
+ amount="20"
+ size="40"
+ duration="1600"
+ delay={[0, 500]}
+ fallDistance="50px"
+ colorArray={["url(/images/bolt.svg)"]}
+ />
+ <ConfettiComp
+ amount="40"
+ delay={[0, 500]}
+ size="15"
+ fallDistance="50px"
+ duration="1600"
+ colorArray={[
+ "#FFD700", // Gold
+ "#FF6F61", // Coral
+ "#6BCB77", // Mint green
+ "#4D96FF", // Light blue
+ "#FF9CEE", // Light pink
+ "#FFD580", // Soft orange
+ "#87CEEB", // Sky blue
+ "#FFB6C1", // Light coral pink
+ "#C1C7FF", // Lavender
+ ]}
+ />
+ {/if}
</div>
</div>