From b2311ae21a10e4fc5a3d8f9bc7fe900c44b22084 Mon Sep 17 00:00:00 2001
From: Brendan F <EpicWolverine@users.noreply.github.com>
Date: Mon, 26 Jun 2023 21:11:56 -0700
Subject: Say Copied! after copying results

---
 src/components/Result/index.tsx | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

(limited to 'src/components/Result/index.tsx')

diff --git a/src/components/Result/index.tsx b/src/components/Result/index.tsx
index 3b3b06c..9eb6d27 100644
--- a/src/components/Result/index.tsx
+++ b/src/components/Result/index.tsx
@@ -1,4 +1,4 @@
-import React from "react";
+import React, { useState } from 'react';
 
 import { Song } from "../../types/song";
 import { GuessType } from "../../types/guess";
@@ -45,14 +45,17 @@ function ShareButton({
   guesses,
   variant
 }:ShareButtonProps) {
-  const copyResult = React.useCallback(() => {
+  const [buttonText, setButtonText] = useState('Copy Results');
+
+  const handleClick = React.useCallback(() => {
     navigator.clipboard.writeText(scoreToEmoji(guesses));
+    setButtonText('Copied!');
   }, [guesses]);
 
   return (
     <>
-      <Button onClick={copyResult} variant={variant}>
-        Copy results
+      <Button onClick={handleClick} variant={variant}>
+        {buttonText}
       </Button>
     </>
   )
-- 
cgit v1.2.3

