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
|
<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"}
>
<button
type="button"
class="flex items-center"
onclick={() => copy(amount)}
aria-label="Copy amount"
>
<iconify-icon noobserver {icon} class="text-yellow-300"
></iconify-icon>{s(amount, locale)}
</button>
{#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"}
>
<button
type="button"
class="flex items-center gap-1"
onclick={() => copy(toFiat(amount, rate).toFixed(2))}
aria-label="Copy fiat amount"
>
{f(toFiat(amount, rate), currency, locale)}
{#if tip}
<span class="text-base">
+{f(toFiat(tip, rate), currency, locale)}
</span>
{/if}
</button>
</h3>
</div>
{/if}
|