diff options
author | Sebastian <sebasjm@gmail.com> | 2022-04-11 11:33:55 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-04-11 11:36:37 -0300 |
commit | 2bd6dae00d420d3b17a636c206785f06f2f7ae29 (patch) | |
tree | 5a93cb26936f0fe8f93731486226bab37c40edba /packages/taler-wallet-webextension/src/components/Amount.tsx | |
parent | df7c249c95bd5583f7cee7cfaabe29b8508babcd (diff) | |
download | wallet-core-2bd6dae00d420d3b17a636c206785f06f2f7ae29.tar.xz |
show amount nicely, into a component
Diffstat (limited to 'packages/taler-wallet-webextension/src/components/Amount.tsx')
-rw-r--r-- | packages/taler-wallet-webextension/src/components/Amount.tsx | 12 |
1 files changed, 12 insertions, 0 deletions
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> + ); +} |