-
Notifications
You must be signed in to change notification settings - Fork 6
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
[FE] Feat/#604 image swiper 적용 및 image size limit 적용 #608
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
75a1999
refactor: PinDetail 빼먹었던 부분 다시 추가
GC-Park 428e3ea
refactor: image wrapper에 key값 적용
GC-Park 21b637f
feat: 핀 디테일 이미지에 스와이퍼 적용
GC-Park c789965
refactor: 이미지 3개 이하면 스와이프 안 나오도록 수정
GC-Park d7f5fa6
refactor: 비로그인 시 이미지 추가 버튼 안 보이도록 수정
GC-Park 32e0aa5
feat: 토픽 사진 추가할 때 사이즈 제한 주기
GC-Park 687d5d1
refactor: 필요없는 코드 삭제
GC-Park File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ import Space from '../common/Space'; | |
import InputContainer from '../InputContainer'; | ||
import Text from '../common/Text'; | ||
import useCompressImage from '../../hooks/useCompressImage'; | ||
import Image from '../common/Image'; | ||
import ImageCommon from '../common/Image'; | ||
import { DEFAULT_TOPIC_IMAGE } from '../../constants'; | ||
import { putApi } from '../../apis/putApi'; | ||
|
||
|
@@ -135,6 +135,7 @@ function UpdatedTopicInfo({ | |
) => { | ||
const file = event.target.files && event.target.files[0]; | ||
const formData = new FormData(); | ||
const currentImage = new Image(); | ||
|
||
if (!file) { | ||
showToast( | ||
|
@@ -145,12 +146,22 @@ function UpdatedTopicInfo({ | |
} | ||
|
||
const compressedFile = await compressImage(file); | ||
formData.append('image', compressedFile); | ||
|
||
await putApi(`/topics/images/${id}`, formData); | ||
|
||
const updatedImageUrl = URL.createObjectURL(compressedFile); | ||
setChangedImages(updatedImageUrl); | ||
currentImage.src = URL.createObjectURL(compressedFile); | ||
|
||
currentImage.onload = async () => { | ||
if (currentImage.width < 300) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍👍👍 |
||
showToast( | ||
'warning', | ||
'이미지의 크기가 너무 작습니다. 다른 이미지를 선택해 주세요.', | ||
); | ||
return; | ||
} | ||
formData.append('image', compressedFile); | ||
await putApi(`/topics/images/${id}`, formData); | ||
|
||
const updatedImageUrl = URL.createObjectURL(compressedFile); | ||
setChangedImages(updatedImageUrl); | ||
}; | ||
}; | ||
|
||
return ( | ||
|
@@ -288,7 +299,7 @@ const ImageInputButton = styled.input` | |
display: none; | ||
`; | ||
|
||
const TopicImage = styled(Image)` | ||
const TopicImage = styled(ImageCommon)` | ||
border-radius: ${({ theme }) => theme.radius.medium}; | ||
`; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
이 부분이 이번 PR핵심으로 보이는데 맞나요?
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.
ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ 맞습니다~ width 300이하는 못 올립니다 ㅎ