From b510cbf9e0f099a85481d2dece14955931278af5 Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Tue, 6 Aug 2024 18:29:39 +0000 Subject: [PATCH] web/donate: add dollar sign before custom input --- .../donate/DonateOptionsCard.svelte | 74 +++++++++++++++---- 1 file changed, 59 insertions(+), 15 deletions(-) diff --git a/web/src/components/donate/DonateOptionsCard.svelte b/web/src/components/donate/DonateOptionsCard.svelte index 8380a73e..adf0de51 100644 --- a/web/src/components/donate/DonateOptionsCard.svelte +++ b/web/src/components/donate/DonateOptionsCard.svelte @@ -13,6 +13,7 @@ let customInput: HTMLInputElement; let customInputValue: number | null; + let customFocused = false; type Processor = "stripe" | "liberapay"; let processor: Processor = "stripe"; @@ -84,18 +85,31 @@
- e.key === 'Enter' && sendCustom()} - /> +
+ {#if customInputValue || customInput?.validity.badInput} + + $ + + {/if} + customFocused = true} + on:focus ={() => customFocused = true} + on:blur ={() => customFocused = false} + on:keydown={(e) => e.key === 'Enter' && sendCustom()} + /> +