-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: imageInputForm 분리, drag&drop구현 #52
Conversation
image input form을 분리했슴다
드래그엔드롭 구현
이미지 삭제시 나머지 파일들에 대해 다시 reader로 읽어왔음 fileList에 의존하는 useEffect제거해서불필요한 re reading 방지
이미지 미리보기랑 실제 파일순서랑 맞춤
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.
고생많앗심더~🍀
app/writepost/page.tsx
Outdated
<ImageInputForm | ||
fileList={files} | ||
setFileList={setFiles} | ||
className="flex flex-col gap-3" | ||
></ImageInputForm> |
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.
호오 간단쓰~ 여기 <ImageInputForm {...} />
이렇게 바꿔주면 센스쟁이~🍀
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.
난 안센스쟁이야
newFileList.splice(index, 1); | ||
newPreview.splice(index, 1); | ||
setFileList(newFileList); | ||
setPreview(newPreview); |
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.
굿쟙👍👍
files.forEach((file, index) => { | ||
const reader = new FileReader(); | ||
reader.readAsDataURL(file); | ||
reader.onloadend = () => { | ||
previews[preview.length + index] = { | ||
src: reader.result as string, | ||
alt: file.name, | ||
}; | ||
cnt++; | ||
if (cnt === files.length) { | ||
setPreview(previews); | ||
setIsLoading(false); | ||
} | ||
}; | ||
}); |
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.
요렇게 하면 동일 파일도 들가는건가용?? 아 근데 delete를 index로 해서 삭제도 에러 없겟다 굿굿👍
Describe your changes
Photo
default.mov
오늘은 영상으로다가 드래그앤드롭이랑 순서 제대로 올라가는거 확인하면 됩니두
Issue number and link