aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/SetAmount.svelte
blob: a453b9d106f4ba2492f501a199f5e835662c85d5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<script>
  import { amountPrompt } from "$lib/store";
  import Numpad from "$comp/Numpad.svelte";
  import Toggle from "$comp/Toggle.svelte";

  let submit = $state();

  let {
    currency = $bindable(),
    fiat = $bindable(),
    locale = $bindable(),
    rate = $bindable(),
    settingAmount,
    setAmount,
    newAmount = $bindable(),
    toggleAmount,
    t,
  } = $props();
</script>

{#if settingAmount}
  <div
    class="fixed inset-0 bg-base-100 bg-opacity-90 overflow-y-auto h-full w-full z-50"
  >
    <div
      class="relative mx-auto p-12 max-w-xl shadow-lg rounded-md bg-base-100 space-y-5"
    >
      <form onsubmit={setAmount} class="space-y-5">
        <Numpad
          bind:amount={newAmount}
          bind:fiat
          {currency}
          {rate}
          {submit}
          {locale}
        />
        <div class="w-full flex flex-wrap gap-2">
          <button
            bind:this={submit}
            type="submit"
            onclick={setAmount}
            class="btn btn-accent"
          >
            <div class="my-auto">{t("payments.ok")}</div>
          </button>
          <button
            type="button"
            class="btn"
            onclick={toggleAmount}
            onkeydown={toggleAmount}
          >
            <div class="my-auto">{t("payments.cancel")}</div>
          </button>
        </div>
      </form>

      <div class="flex justify-center gap-3">
        <div class="text-secondary">{t("payments.amountPrompt")}</div>
        <Toggle id="notify" bind:value={$amountPrompt} />
      </div>
    </div>
  </div>
{/if}