web/DonationOption: use icon prop instead of slot

This commit is contained in:
wukko 2024-11-20 14:15:03 +06:00
parent 540bbbdad7
commit a0616841bf
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2
2 changed files with 5 additions and 5 deletions

View file

@ -176,14 +176,13 @@
showRightScroll = currentPos < maxPos && currentPos !== maxPos; showRightScroll = currentPos < maxPos && currentPos !== maxPos;
}} }}
> >
{#each Object.entries(PRESET_DONATION_AMOUNTS) as [amount, component]} {#each Object.entries(PRESET_DONATION_AMOUNTS) as [amount, icon]}
<DonationOption <DonationOption
price={+amount} price={+amount}
desc={$t(`donate.card.option.${amount}`)} desc={$t(`donate.card.option.${amount}`)}
href={donationMethods[processor](+amount * 100)} href={donationMethods[processor](+amount * 100)}
> {icon}
<svelte:component this={component} /> />
</DonationOption>
{/each} {/each}
</div> </div>
</div> </div>

View file

@ -2,6 +2,7 @@
export let price: number; export let price: number;
export let desc: string; export let desc: string;
export let href: string; export let href: string;
export let icon: ConstructorOfATypedSvelteComponent;
const USD = new Intl.NumberFormat("en-US", { const USD = new Intl.NumberFormat("en-US", {
style: "currency", style: "currency",
@ -17,7 +18,7 @@
}} }}
> >
<div class="donate-card-title"> <div class="donate-card-title">
<slot></slot> <svelte:component this={icon} />
{USD.format(price)} {USD.format(price)}
</div> </div>
<div class="donate-card-subtitle">{desc}</div> <div class="donate-card-subtitle">{desc}</div>