aboutsummaryrefslogtreecommitdiffstats
path: root/GPL.txt
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2016-09-17 19:08:23 -0700
committerAdam Soltys <[email protected]>2016-09-17 19:08:23 -0700
commit90da658fe477005ad8ab140d205b0d0e1dce00ea (patch)
tree737e3a1da5762ab5e026767307bda2265d89d8b0 /GPL.txt
parent898d21a7cc1fe23a48896618e638b63130ac7c8c (diff)
download<
<script>
  import { copy, s, f, toFiat } from "$lib/utils";
  import { fiat } from "$lib/store";
  const {
    align,
    amount,
    locale,
    tip,
    rate,
    currency,
    locked = false,
  } = $props();

  const icon = $derived(locked ? "ph:lock-fill" : "ph:lightning-fill");
</script>

{#if typeof amount !== "undefined"}
  <div>
    <h2
      class="text-2xl md:text-3xl font-semibold flex items-end cursor-copy"
      class:justify-center={align !== "left"}
    >
      <div class="flex items-center" onclick={() => copy(amount)}>
        <iconify-icon noobserver {icon} 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 noobserver {icon} class="text-yellow-300"
          ></iconify-icon>
          <div>{s(tip, locale)}</div>
        </div>
      {/if}
    </h2>
    <h3
      class="flex text-secondary md:text-lg cursor-copy items-center gap-1"
      class:justify-center={align !== "left"}
      onclick={() => copy(toFiat(amount, rate).toFixed(2))}
    >
      {f(toFiat(amount, rate), currency, locale)}
      {#if tip}
        <span class="text-base">
          +{f(toFiat(tip, rate), currency, locale)}
        </span>
      {/if}
    </h3>
  </div>
{/if}