diff options
| author | Adam Soltys <[email protected]> | 2025-03-05 16:03:54 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-03-05 16:03:54 -0800 |
| commit | 6f59a0db6c82d758411b07b889dadb95f99e0349 (patch) | |
| tree | 76f524baeeae5a9fb2ec9071f19f1c7690fa4ef8 /src/components/AmountField.svelte | |
| parent | c1b2337d23af966ae39a09b73f12a1bc189a2eb0 (diff) | |
| download | coinos-ui-6f59a0db6c82d758411b07b889dadb95f99e0349.tar.gz coinos-ui-6f59a0db6c82d758411b07b889dadb95f99e0349.zip | |
nwc maxfee field
Diffstat (limited to 'src/components/AmountField.svelte')
| -rw-r--r-- | src/components/AmountField.svelte | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/components/AmountField.svelte b/src/components/AmountField.svelte new file mode 100644 index 00000000..abfc4d1e --- /dev/null +++ b/src/components/AmountField.svelte @@ -0,0 +1,64 @@ +<script> + import { t } from "$lib/translations"; + import { tick } from "svelte"; + import Numpad from "$comp/Numpad.svelte"; + + let { amount = $bindable(), desc, currency, rate, label, name } = $props(); + + let setting = $state(); + let set = () => { + setting = false; + }; + let done = $state(); + let startSetting = async () => { + setting = true; + await tick(); + numpad.focus(); + }; + let numpad = $state(); +</script> + +<div> + <label for="name" class="font-bold mb-1 block">{label}</label> + + {#if desc} + <p class="text-secondary my-2">{desc}</p> + {/if} + + <button type="button" class="flex w-full" onclick={startSetting}> + <div class="p-4 border rounded-2xl rounded-r-none border-r-0 bg-base-200"> + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300" + ></iconify-icon> + </div> + + <div + class="border-l-0 rounded-l-none pl-2 w-full p-4 border rounded-2xl text-left" + > + {amount || $t("accounts.none")} + </div> + <input type="hidden" {name} bind:value={amount} /> + </button> +</div> + +{#if setting} + <div + class="fixed bg-base-100 bg-opacity-90 inset-0 overflow-y-auto h-full w-full z-50 max-w-lg mx-auto" + > + <div class="relative p-5 border shadow-lg rounded-md bg-base-100 space-y-5"> + <h1 class="text-center text-2xl font-semibold"> + {label} + </h1> + <Numpad + bind:amount + {currency} + {rate} + bind:submit={done} + bind:element={numpad} + /> + + <button bind:this={done} type="button" onclick={set} class="btn" + >Ok</button + > + </div> + </div> +{/if} |
