From 26721219802be2ae9655943e610554a1b47eafbd Mon Sep 17 00:00:00 2001 From: piotrruss Date: Sat, 14 Aug 2021 19:13:46 +0200 Subject: copy to clipboard, icons, notes key --- apps/Notes/helpers/copyToClipboard.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 apps/Notes/helpers/copyToClipboard.js (limited to 'apps/Notes/helpers') diff --git a/apps/Notes/helpers/copyToClipboard.js b/apps/Notes/helpers/copyToClipboard.js new file mode 100644 index 0000000..608d299 --- /dev/null +++ b/apps/Notes/helpers/copyToClipboard.js @@ -0,0 +1,19 @@ +const copyToClipboard = (text, setPopup) => { + navigator + .clipboard.writeText(text) + .then(() => { + setPopup({ + content: 'Note content was copied to clipboard', + time: 2000, + }) + }) + .catch(() => { + setPopup({ + content: 'Could not copy to clipboard', + time: 2000, + error: true + }) + }) +} + +export default copyToClipboard -- cgit v1.2.3