summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-03-13 09:44:11 -0300
committerSebastian <sebasjm@gmail.com>2024-03-13 09:44:11 -0300
commitce47869552729a996b34a0370ac44df2791b954e (patch)
tree00d92de8afb5fb60566f330e6108e4a8db7038fc /packages
parent65148a9e9137329c5e59620ecff412967fa89fc1 (diff)
downloadwallet-core-ce47869552729a996b34a0370ac44df2791b954e.tar.gz
wallet-core-ce47869552729a996b34a0370ac44df2791b954e.tar.bz2
wallet-core-ce47869552729a996b34a0370ac44df2791b954e.zip
allow text in copy button
Diffstat (limited to 'packages')
-rw-r--r--packages/web-util/src/components/CopyButton.tsx6
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/web-util/src/components/CopyButton.tsx b/packages/web-util/src/components/CopyButton.tsx
index fd7f8b3b4..dbb38b474 100644
--- a/packages/web-util/src/components/CopyButton.tsx
+++ b/packages/web-util/src/components/CopyButton.tsx
@@ -1,4 +1,4 @@
-import { h, VNode } from "preact";
+import { ComponentChildren, h, VNode } from "preact";
import { useEffect, useState } from "preact/hooks";
export function CopyIcon(): VNode {
@@ -17,7 +17,7 @@ export function CopiedIcon(): VNode {
)
};
-export function CopyButton({ class: clazz, getContent }: { class: string, getContent: () => string }): VNode {
+export function CopyButton({ class: clazz, children, getContent }: { children?: ComponentChildren, class: string, getContent: () => string }): VNode {
const [copied, setCopied] = useState(false);
function copyText(): void {
if (!navigator.clipboard && !window.isSecureContext) {
@@ -43,12 +43,14 @@ export function CopyButton({ class: clazz, getContent }: { class: string, getCon
copyText()
}} >
<CopyIcon />
+ {children}
</button>
);
}
return (
<button class={clazz} disabled>
<CopiedIcon />
+ {children}
</button>
);
}