From 594f3352010fcd0dfdefcbcd07598e319aadaffb Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Wed, 10 Apr 2024 17:46:34 -0400 Subject: [PATCH] Show alert when url copied ghstack-source-id: e8dba44d246d53f60a0858710cedf75c77c6c7e4 Pull Request resolved: https://github.com/facebook/react-forget/pull/2835 --- compiler/apps/playground/components/Header.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/apps/playground/components/Header.tsx b/compiler/apps/playground/components/Header.tsx index 44170b561b..d18505a9d9 100644 --- a/compiler/apps/playground/components/Header.tsx +++ b/compiler/apps/playground/components/Header.tsx @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ - import { RefreshIcon, ShareIcon, TrashIcon } from "@heroicons/react/outline"; import { CheckIcon } from "@heroicons/react/solid"; import clsx from "clsx"; @@ -18,7 +17,7 @@ import { useStoreDispatch } from "./StoreContext"; export default function Header() { const [showCheck, setShowCheck] = useState(false); const dispatchStore = useStoreDispatch(); - const { closeSnackbar } = useSnackbar(); + const { enqueueSnackbar, closeSnackbar } = useSnackbar(); const handleReset = () => { if (confirm("Are you sure you want to reset the playground?")) { @@ -43,6 +42,7 @@ export default function Header() { const handleShare = () => { navigator.clipboard.writeText(location.href).then(() => { + enqueueSnackbar("URL copied to clipboard"); setShowCheck(true); // Show the check mark icon briefly after URL is copied setTimeout(() => setShowCheck(false), 1000);