aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Amount.svelte
blob: 035152d1076e3c31054f46f5ed61e56ecb7ee99a (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
<script>
  import { s, f, toFiat } from "$lib/utils";
  import { fiat } from "$lib/store";
  const { amount, locale, tip, rate, currency } = $props();
</script>

{#if amount}
  <div>
    <h2
      class="text-2xl md:text-3xl font-semibold flex justify-center items-end"
    >
      <div class="flex items-center">
        <iconify-icon icon="ph:lightning-fill" class="text-yellow-300"
        ></iconify-icon>{s(amount, locale)}
      </div>

      {#if tip}
        <div class="flex items-center text-lg ml-2">
          <div>+</div>
          <iconify-icon icon="ph:lightning-fill" class="text-yellow-300"
          ></iconify-icon>
          <div>{s(tip, locale)}</div>
        </div>
      {/if}
    </h2>
    <h3 class="flex text-secondary md:text-lg justify-center">
      {f(toFiat(amount, rate), currency, locale)}
      {#if tip}
        <span class="text-base">
          + {f(toFiat(tip, rate), currency, locale)}
        </span>
      {/if}
    </h3>
  </div>
{/if}