aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Numpad.svelte
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-11-05 13:31:53 -0800
committerAdam Soltys <[email protected]>2024-11-05 13:31:53 -0800
commite3afaf16b32558ac2ac407777760e462b4896a92 (patch)
treeca32d28511b599a0f4e94a9ea3d39b31417650bf /src/components/Numpad.svelte
parent69f4ccba75a0b3b4343d7fd7f910d767c62e25f9 (diff)
downloadcoinos-ui-e3afaf16b32558ac2ac407777760e462b4896a92.tar.gz
coinos-ui-e3afaf16b32558ac2ac407777760e462b4896a92.zip
dark styles
Diffstat (limited to 'src/components/Numpad.svelte')
-rw-r--r--src/components/Numpad.svelte35
1 files changed, 17 insertions, 18 deletions
diff --git a/src/components/Numpad.svelte b/src/components/Numpad.svelte
index 694f5754..07d1ef4c 100644
--- a/src/components/Numpad.svelte
+++ b/src/components/Numpad.svelte
@@ -181,6 +181,18 @@
let keydown = (e) =>
e.key === "Enter" && (e.preventDefault() || submit.click());
+
+ let swap = () => {
+ if (fiat) {
+ amount = parseInt((amountFiat / (rate / sats)).toFixed(0));
+ } else {
+ amountFiat =
+ (amount * (rate / sats)).toFixed(2) > 0.0
+ ? (amount * (rate / sats)).toFixed(2)
+ : 0;
+ }
+ fiat = !fiat;
+ };
</script>
<div class="flex justify-center items-center">
@@ -204,24 +216,11 @@
bind:this={element}
/>
</div>
- <div class="mt-2">
- <span class="text-secondary mr-1"
- >{fiat ? "⚡️" + s(amount) : f(amountFiat, currency)}</span
- >
- <button
- type="button"
- on:click|preventDefault|stopPropagation={() => {
- if (fiat) {
- amount = parseInt((amountFiat / (rate / sats)).toFixed(0));
- } else {
- amountFiat =
- (amount * (rate / sats)).toFixed(2) > 0.0
- ? (amount * (rate / sats)).toFixed(2)
- : 0;
- }
- fiat = !fiat;
- }}><Icon icon="swap" style="inline hover:opacity-80" /></button
- >
+ <div
+ class="flex items-center justify-center text-2xl cursor-pointer"
+ on:click|preventDefault|stopPropagation={swap}
+ >
+ {fiat ? "⚡️" + s(amount) : f(amountFiat, currency)}
</div>
</div>