diff --git a/src/components/elements/favorites-list.tsx b/src/components/elements/favorites-list.tsx index bfd080bf..e3c7634b 100644 --- a/src/components/elements/favorites-list.tsx +++ b/src/components/elements/favorites-list.tsx @@ -1,10 +1,56 @@ "use client"; import useFavorites from "@lib/hooks/useFavorites"; -import {ChatBubbleLeftEllipsisIcon, ClipboardDocumentIcon, EnvelopeIcon, HeartIcon} from "@heroicons/react/24/outline"; +import { ChatBubbleLeftEllipsisIcon, ClipboardDocumentIcon, EnvelopeIcon, HeartIcon} from "@heroicons/react/24/outline"; import {useIsClient} from "usehooks-ts"; import { XMarkIcon } from "@heroicons/react/20/solid"; +const ShareButtons = () => { + const handleCopy = async () => { + try { + await navigator.clipboard.writeText(window.location.href); + alert("URL copied to clipboard!"); + } catch (error) { + console.error("Failed to copy URL: ", error); + alert("Failed to copy URL. Please try again."); + } + }; + + const handleSendEmail = () => { + const subject = "Check out these summer courses!"; + const body = `Here is the link: ${window.location.href}`; + window.location.href = `mailto:?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`; + }; + + const handleSendSMS = () => { + const body = `Check out this link: ${window.location.href}`; + window.location.href = `sms:?body=${encodeURIComponent(body)}`; + }; + + return ( + <> + + + + > + ); +}; + const FavoritesList = () => { const { favs, removeFav } = useFavorites(); @@ -16,22 +62,22 @@ const FavoritesList = () => { return (