-
Notifications
You must be signed in to change notification settings - Fork 6
Feat: 이미지 저장 기능 구현 완료 #295
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
base: dev
Are you sure you want to change the base?
Conversation
|
@Eugene-A-01 is attempting to deploy a commit to the Eujin Ahn's projects Team on Vercel. A member of the Team first needs to authorize it. |
seoyoung-min
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGGGGGGGTM 👍
| useEffect(() => { | ||
| const timer = setTimeout(() => { | ||
| if (captureRef.current) { | ||
| const clonedCapture = captureRef.current.cloneNode(true) as HTMLDivElement; | ||
| clonedCapture.style.width = `${window.innerWidth}px`; | ||
| clonedCapture.style.height = `${window.innerHeight}px`; | ||
| clonedCapture.style.padding = '50px 30px'; | ||
|
|
||
| document.body.appendChild(clonedCapture); | ||
|
|
||
| toPng(clonedCapture, { backgroundColor: '#fff' }) | ||
| .then((dataUrl) => { | ||
| const link = document.createElement('a'); | ||
| link.download = `listywave_${data.title}.png`; | ||
| link.href = dataUrl; | ||
| link.click(); | ||
| toasting({ type: 'success', txt: '이미지를 저장하였습니다' }); | ||
| }) | ||
| .catch((err) => { | ||
| console.error('이미지 저장 오류:', err); | ||
| toasting({ type: 'error', txt: '이미지 저장을 실패했습니다.' }); | ||
| }) | ||
| .finally(() => { | ||
| document.body.removeChild(clonedCapture); | ||
| onClose(); | ||
| }); | ||
| } | ||
| }, 1000); | ||
|
|
||
| return () => clearTimeout(timer); | ||
| }, [data.title, onClose]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
모달로 띄워지고 자동으로 닫히고 저장까지 너무 완벽하게 구현해주셔서 놀랐어요!!🥹 ver2때 만들어 둔 디자인은 있는데 ver3용은 없네요ㅠ, ver3에 맞게 어떻게 바꿀 수 있을지 고민해보겠습니다!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b7824a5 to
b3265a0
Compare

개요
작업 사항
스크린샷
2025-03-03.6.59.45.mov
리뷰어에게