Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UPDATE] evetnCalendar 클립보드 복사 성공시 Toast #33

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,23 @@ export const ButtonVariants = cva(
'text-[var(--white)]'

],
toast:
[
'inline-flex',
'h-[40px]',
'px-[20px]',
'justify-center',
'items-center',
'gap-[10px]',
'rounded-[8px]',
'!bg-[var(--gray-900)]',
'!text-[var(--white)]',
'!font-pretendard',
'text-[var(--font-size-14)]',
'font-[var(--font-md)]',
'leading-[var(--line-height-16)]',
'tracking-[var(--spacing)]'
]
},
},
defaultVariants: {
Expand Down
33 changes: 22 additions & 11 deletions src/pages/eventCalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ const shareString = `https://when-will-we-meet.site/invite?appointmentId=${appoi
const clipboardShare = async() =>{
try{
await navigator.clipboard.writeText(shareString);
alert('초대코드 복사되었습니다~');
closeModal(); // 모달 닫기
setShowToast(true); // 토스트 표시
setTimeout(() => {
setShowToast(false); // 2초 후 자동 닫기
}, 2000);
}catch(e){
alert('복사 실패 ㅠㅠ');
}
Expand Down Expand Up @@ -361,6 +365,7 @@ const KakaoShare = async() => {
flex-shrink-0
flex-grow-0
basis-[25%]
cursor-pointer
`}

onClick={() => setSelectedDate(key)}
Expand Down Expand Up @@ -409,7 +414,7 @@ const KakaoShare = async() => {
size={"XXS"}
additionalClass={`
${colorClass}

pointer-events-none
items-center !transform-none
`}
/>
Expand Down Expand Up @@ -505,15 +510,21 @@ const KakaoShare = async() => {
</motion.div>
)}
</AnimatePresence>
{/* {showToast && (
<div className="fixed bottom-4 right-4 flex items-center bg-white rounded-lg shadow-lg p-4 transition-opacity duration-300">
<img
src="/Toast_CopyLink.svg"
alt="Copy Success"
className="w-6 h-6 mr-2"
/>
</div>
)} */}
<AnimatePresence>
{showToast && (
<motion.div
className="fixed bottom-0 left-0 right-0 flex justify-center mb-[8rem]"
initial={{ y: '400%' }}
animate={{ y: 0 }}
exit={{ y: '400%' }}
transition={{ duration: 0.2, ease: 'easeOut' }}
>
<Button label="링크가 복사되었습니다!" size={'toast'}
onClick={handleSaveClick}
additionalClass= 'z-50 pointer-events-none' />
</motion.div>
)}
</AnimatePresence>
</div>
</div>

Expand Down