diff options
author | Sebastian <sebasjm@gmail.com> | 2021-09-20 00:18:52 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2021-09-20 00:18:52 -0300 |
commit | 08bc5c6d8913513ed8e4a2038968fa8f05969e90 (patch) | |
tree | c44c59ff29d734e950bf0fd1fc4c34d1825dc42a /packages/taler-wallet-webextension/src/components/ExchangeToS.tsx | |
parent | 62b64cb453f6a4fd62c64bdd8e3240d5d7f03ce4 (diff) | |
download | wallet-core-08bc5c6d8913513ed8e4a2038968fa8f05969e90.tar.xz |
fix some feedback from belen
Diffstat (limited to 'packages/taler-wallet-webextension/src/components/ExchangeToS.tsx')
-rw-r--r-- | packages/taler-wallet-webextension/src/components/ExchangeToS.tsx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/packages/taler-wallet-webextension/src/components/ExchangeToS.tsx b/packages/taler-wallet-webextension/src/components/ExchangeToS.tsx index 0325daa04..b7b0d2fd9 100644 --- a/packages/taler-wallet-webextension/src/components/ExchangeToS.tsx +++ b/packages/taler-wallet-webextension/src/components/ExchangeToS.tsx @@ -28,6 +28,11 @@ export function ExchangeXmlTos({ doc }: { doc: Document }) { </Fragment> } +/** + * Map XML elements into HTML + * @param child + * @returns + */ function renderChild(child: Element): VNode { const children = Array.from(child.children) switch (child.nodeName) { @@ -55,13 +60,16 @@ function renderChild(child: Element): VNode { } } +/** + * Simple anchor with a state persisted into 'data-open' prop + * @returns + */ function AnchorWithOpenState(props: JSXInternal.HTMLAttributes<HTMLAnchorElement>) { const [open, setOpen] = useState<boolean>(false) function doClick(e: JSXInternal.TargetedMouseEvent<HTMLAnchorElement>) { setOpen(!open); - e.stopPropagation(); e.preventDefault(); } - return <a data-open={JSON.stringify(open)} onClick={doClick} {...props} /> + return <a data-open={open ? 'true' : 'false'} onClick={doClick} {...props} /> } |