From 2bd6dae00d420d3b17a636c206785f06f2f7ae29 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Mon, 11 Apr 2022 11:33:55 -0300
Subject: show amount nicely, into a component

---
 packages/taler-wallet-webextension/src/components/Amount.tsx | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 packages/taler-wallet-webextension/src/components/Amount.tsx

(limited to 'packages/taler-wallet-webextension/src/components/Amount.tsx')

diff --git a/packages/taler-wallet-webextension/src/components/Amount.tsx b/packages/taler-wallet-webextension/src/components/Amount.tsx
new file mode 100644
index 000000000..c41f7faf6
--- /dev/null
+++ b/packages/taler-wallet-webextension/src/components/Amount.tsx
@@ -0,0 +1,12 @@
+import { AmountJson, Amounts, AmountString } from "@gnu-taler/taler-util";
+import { h, VNode, Fragment } from "preact";
+
+export function Amount({ value }: { value: AmountJson | AmountString }): VNode {
+  const aj = Amounts.jsonifyAmount(value);
+  const amount = Amounts.stringifyValue(aj, 2);
+  return (
+    <Fragment>
+      {amount} {aj.currency}
+    </Fragment>
+  );
+}
-- 
cgit v1.2.3

