From 37d6c0171e4a284104d06e25fc5bf726a79ab6a3 Mon Sep 17 00:00:00 2001 From: Jen Breese-Kauth Date: Wed, 18 Dec 2024 20:29:58 +0000 Subject: [PATCH] SUM-260: adding a tooltip --- src/components/elements/favorites-list.tsx | 56 +++++++++++++++------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/src/components/elements/favorites-list.tsx b/src/components/elements/favorites-list.tsx index 34e0e0d..90e6a22 100644 --- a/src/components/elements/favorites-list.tsx +++ b/src/components/elements/favorites-list.tsx @@ -7,6 +7,7 @@ import {XMarkIcon} from "@heroicons/react/20/solid" import {H2} from "./headers" import {clsx} from "clsx" import {twMerge} from "tailwind-merge" +import {useState} from "react" const ShareButtons = () => { const [, copy] = useCopyToClipboard() @@ -19,6 +20,42 @@ const ShareButtons = () => { copy(text).catch(_e => console.warn("An error occurred when copying to clipboard")) } + function clipCopiedText() { + const [isActive, setIsActive] = useState(false) + + return ( + <> + + {/* className={"list-unstyled " + (isActive ? "" : "tw-hidden")} */} +
+ Copied! +
+ + ) + } + const smsCopy = "sms:?body=" + encodeURIComponent( @@ -33,7 +70,7 @@ const ShareButtons = () => { ) return ( -
+
- + + {clipCopiedText()}
) }