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

feat(toks-components, quiz): Image Preview 기능 구현 #403

Merged
merged 10 commits into from
Feb 18, 2024

Conversation

chaaerim
Copy link
Member

💡 왜 PR을 올렸나요?

  • close [feature] Image Preview 기능구현 #397
  • quiz image preview 기능을 구현했습니다 .
  • 퀴즈 버튼 영역을 이미지를 제외한 영역으로 축소했습니다.
  • next/Image warning을 수정했습니다.

💁 무엇이 어떻게 바뀌나요?

💬 리뷰어분들께

@LineGu LineGu enabled auto-merge (squash) February 15, 2024 17:56
@codecov-commenter
Copy link

codecov-commenter commented Feb 15, 2024

Codecov Report

Attention: 133 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (dev@ca8aba3). Click here to learn what that means.

Files Patch % Lines
src/common/components/Modal/index.tsx 0.00% 67 Missing ⚠️
src/app/quiz/components/QuizButton/Thumbnail.tsx 0.00% 36 Missing ⚠️
src/app/quiz/components/QuizButton/index.tsx 0.00% 8 Missing ⚠️
src/app/my-page/components/LogoutBar/index.tsx 0.00% 3 Missing ⚠️
...app/my-page/components/LogoutBottonSheet/index.tsx 0.00% 3 Missing ⚠️
src/app/my-page/page.tsx 0.00% 3 Missing ⚠️
src/app/nickname/components/NicknameBox.tsx 0.00% 3 Missing ⚠️
...rc/app/quiz/components/ScrollToTopButton/index.tsx 0.00% 3 Missing ⚠️
src/common/components/Appbar/index.tsx 0.00% 3 Missing ⚠️
src/common/components/BackHeader/index.tsx 0.00% 3 Missing ⚠️
... and 1 more
Additional details and impacted files
@@          Coverage Diff          @@
##             dev    #403   +/-   ##
=====================================
  Coverage       ?   0.07%           
=====================================
  Files          ?     178           
  Lines          ?    6341           
  Branches       ?     178           
=====================================
  Hits           ?       5           
  Misses         ?    6336           
  Partials       ?       0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 11 to 12
extends Pick<QuizButtonProps, 'OXType' | 'imageUrl' | 'className'>,
HTMLAttributes<HTMLDivElement> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

혹시 onClick이 필요해서 HTMLAttributes<HTMLDivElement>이 타입을 붙인거라면 QuizButtonProps에 onClick이 있기 때문에 Pick<QuizButtonProps, 'OXType' | 'imageUrl' | 'className' | 'onClick'>해주었어도 좋았을 것 같습니다...!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'onClick' 속성의 형식이 호환되지 않습니다. 'MouseEventHandler<HTMLButtonElement> | undefined' 형식은 'MouseEventHandler<HTMLDivElement> | undefined' 형식에 할당할 수 없습니다. onClick이 호환이 안되는 문제 때문에 따로 extends 해주었습니다!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

근데 썸네일 컴포넌트 내부로 모달 컴포넌트를 종속시키면 해당 attribute extends는 더이상 필요 없을 것 같네요!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아아 그러네요 그나저나 저렇게 하면 안되는군요 흠흠

Comment on lines 30 to 52
<Thumbnail
className="mb-24px w-full"
OXType={OXType}
imageUrl={imageUrl}
name={name}
onClick={() => {
setIsShow(true);
}}
/>
{!OXType && (
<Modal isShow={isShow} onClose={() => setIsShow(false)}>
<img
className="rounded-8px"
src={imageUrl}
alt={`${name}사진`}
style={{
width: '100%',
objectFit: 'cover',
objectPosition: 'center',
}}
/>
</Modal>
)}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

썸네일 클릭 => 모달 등장이 서비스 내 고정적인 스펙이라면 해당 썸네일 확대용 모달을 썸네일 컴포넌트 안에 종속시키면 어떨까요?
모달이 썸네일 안으로 들어가고 isShow state를 썸네일 안에 두면 어떨지 의견 남겨봅니다!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 같은 의견으로 Preview + Modal은 세트로 가져가도 좋을 것 같습니다

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵넵 썸네일과 모달 컴포넌트 하나로 합쳐볼게요~!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

40a8a69 썸네일 컴포넌트에 모달 컴포넌트 종속시키는 방식으로 수정했습니다!

Comment on lines +26 to +30
className="h-auto w-24px"
src={ICON_URL.CHEVRON_RIGHT}
alt="로그아웃 버튼"
width={24}
height={24}
width="0"
height="0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요거 무슨 차이인가요??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

next Image를 사용할 때 콘솔에 src has either width or height modified, but not the other. If you use CSS to change the size of your image, also include the styles 'width: "auto"' or 'height: "auto"' to maintain the aspect ratio. warning이 여러번 떴었는데요, 해당 warning을 해결하기 위해서는 width나 height 둘 중 하나를 auto로 설정해서 ratio를 맞춰야하는데 next Image를 사용할 때에는 width와 height 두 속성 모두 지정을 해줘야만했기 때문에 위와 같은 방식으로 작성하게 되었습니다!
next/image

Comment on lines 30 to 52
<Thumbnail
className="mb-24px w-full"
OXType={OXType}
imageUrl={imageUrl}
name={name}
onClick={() => {
setIsShow(true);
}}
/>
{!OXType && (
<Modal isShow={isShow} onClose={() => setIsShow(false)}>
<img
className="rounded-8px"
src={imageUrl}
alt={`${name}사진`}
style={{
width: '100%',
objectFit: 'cover',
objectPosition: 'center',
}}
/>
</Modal>
)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 같은 의견으로 Preview + Modal은 세트로 가져가도 좋을 것 같습니다

Comment on lines 38 to 56
<div
onClick={() => {
onClose();
}}
className={cn(
'fixed left-0 top-0 z-50 flex h-full w-full items-center justify-center bg-gray-120/80 p-20px',
{
hidden: !isShow,
'animate-fade-in-back-drop': isShow,
}
)}
>
<div className="flex flex-col">
<button className="flex justify-end pb-16px" onClick={() => onClose()}>
<Image src={ICON_URL.CLOSE} alt="close" width={24} height={24} />
</button>
{children}
</div>
</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 framer-motion 라이브러리 있는데 요거로 바꾸면 좋을 것 같습니다.

AnimationPresence 등 유용한 유틸을 추후에 추가하기 편할 것 같아서 제시해봅니당

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dfa9684 framer 적용했습니다 ~!

Copy link
Collaborator

@duhyeonyoon duhyeonyoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다 👍

@LineGu LineGu merged commit 3fe9e07 into dev Feb 18, 2024
2 checks passed
@LineGu LineGu deleted the feat/image-preview branch February 18, 2024 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] Image Preview 기능구현
6 participants