diff options
Diffstat (limited to 'packages/web-util/src/components/CopyButton.tsx')
-rw-r--r-- | packages/web-util/src/components/CopyButton.tsx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/web-util/src/components/CopyButton.tsx b/packages/web-util/src/components/CopyButton.tsx index e76447291..bb08b99ef 100644 --- a/packages/web-util/src/components/CopyButton.tsx +++ b/packages/web-util/src/components/CopyButton.tsx @@ -1,5 +1,7 @@ import { h, VNode } from "preact"; +import { useTransition } from "preact/compat"; import { useEffect, useState } from "preact/hooks"; +import { useTranslationContext } from "../index.browser.js"; export function CopyIcon(): VNode { return ( @@ -19,6 +21,7 @@ export function CopiedIcon(): VNode { export function CopyButton({ class: clazz, getContent }: { class: string, getContent: () => string }): VNode { const [copied, setCopied] = useState(false); + const {i18n} = useTranslationContext() function copyText(): void { if (!navigator.clipboard && !window.isSecureContext) { alert('clipboard is not available on insecure context (http)') @@ -38,7 +41,7 @@ export function CopyButton({ class: clazz, getContent }: { class: string, getCon if (!copied) { return ( - <button class={clazz} onClick={copyText} > + <button class={clazz} onClick={copyText} aria-label={i18n.str`Copy`} > <CopyIcon /> </button> ); |