diff --git a/Caecae/src/features/FindingGameLanding/LadingPageTitle.tsx b/Caecae/src/features/FindingGameLanding/LadingPageTitle.tsx index dabb87d..07e0479 100644 --- a/Caecae/src/features/FindingGameLanding/LadingPageTitle.tsx +++ b/Caecae/src/features/FindingGameLanding/LadingPageTitle.tsx @@ -1,8 +1,43 @@ +import { useState } from "react"; + interface LadingPageTitleProps { onClick: () => void; } const LadingPageTitle = ({ onClick }: LadingPageTitleProps) => { + const [showMessage, setShowMessage] = useState(false); + const [animate, setAnimate] = useState(false); + const [isAnimating, setIsAnimating] = useState(false); + + const shareEvent = () => { + if (isAnimating) return; + setIsAnimating(true); + const url: string = window.location.href; + + navigator.clipboard.writeText(url) + .then(() => { + setShowMessage(true); + + setTimeout(() => { + setAnimate(true); + + setTimeout(() => { + setAnimate(false); + + setTimeout(() => { + setShowMessage(false); + setIsAnimating(false); + }, 500); + + }, 3000); + + }, 10); + }) + .catch((err: Error) => { + console.error('URL 복사에 실패했습니다.', err); + setIsAnimating(false); + }); + }; return ( <>
공유하기
++ 공유하기 +