Skip to content

Commit

Permalink
2.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mathewjordan committed Jul 31, 2024
1 parent 7e71769 commit 767d3f4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@samvera/clover-iiif",
"version": "2.9.1",
"version": "2.10.0",
"description": "Extensible IIIF front-end toolkit and Manifest viewer. Accessible. Composable. Open Source.",
"files": [
"dist"
Expand Down
9 changes: 6 additions & 3 deletions src/hooks/useCopyToClipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { useTranslation } from "react-i18next";
export const useCopyToClipboard = (
text: string,
notifyTimeout = 2500,
): [string | undefined, () => void] => {
): [string, () => void] => {
const { t } = useTranslation();

const [copyStatus, setCopyStatus] = useState();
const [copyStatus, setCopyStatus] = useState("");
const copy = useCallback(() => {
navigator.clipboard.writeText(text).then(
() => setCopyStatus(t("copySuccess")),
Expand All @@ -19,7 +19,10 @@ export const useCopyToClipboard = (
useEffect(() => {
if (!copyStatus) return;

const timeoutId = setTimeout(() => setCopyStatus(undefined), notifyTimeout);
const timeoutId = setTimeout(
() => setCopyStatus(t("copyFailure")),
notifyTimeout,
);

return () => clearTimeout(timeoutId);
}, [copyStatus]);
Expand Down

0 comments on commit 767d3f4

Please sign in to comment.