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

refactor: MemberImage 컴포넌트 추가 #15

Merged
merged 4 commits into from
Jan 29, 2024
Merged

Conversation

xodms0309
Copy link
Member

Issue

✨ 구현한 기능

  • 페이지들에 흩어져있던 멤버 이미지 컴포넌트들을 하나의 컴포넌트로 빼서 교체했습니다.
  • 현재 카톡 기본 이미지가 다 404 뜨는데 에러가 뜬다면 기본 냐미..?뇨미? 아무튼 얘 보여주게 했습니다.
스크린샷 2024-01-05 오후 5 44 12

📢 논의하고 싶은 내용

너무 오랜만에 코드 쳐서 잘 모르겠어요..

🎸 기타

  • x

⏰ 일정

  • 추정 시간 : 1
  • 걸린 시간 : 1

@xodms0309 xodms0309 self-assigned this Jan 5, 2024
Copy link

github-actions bot commented Jan 5, 2024

Test Results

2 tests   2 ✅  7s ⏱️
1 suites  0 💤
1 files    0 ❌

Results for commit b5a50bb.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@Leejin-Yang Leejin-Yang left a comment

Choose a reason for hiding this comment

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

컴포넌트화 한거 매우 좋습니다 👍
코멘트 하나 달았는데 확인해주세요~

Comment on lines 16 to 20
const [imageSrc, setImageSrc] = useState(src);

const handleImageError = () => {
setImageSrc(DefaultMemberImage);
};
Copy link
Contributor

Choose a reason for hiding this comment

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

상태에 경로를 담는것 보다 boolean으로 다루면 어떨까요??

Copy link
Member Author

@xodms0309 xodms0309 Jan 9, 2024

Choose a reason for hiding this comment

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

밑에서 그럼

{isError ? <DefaultMemberImage/> : <MemberImage /> }

이런식으로 처리하라는 말씀이신가요?!

Copy link
Contributor

Choose a reason for hiding this comment

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

아래 src 속성에서 처리하면 좋아보여요.!
불린 속성에 따라 src가 변하게?!

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
Contributor

@Leejin-Yang Leejin-Yang left a comment

Choose a reason for hiding this comment

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

수고했어요~👍

Comment on lines +16 to +31
const [isError, setIsError] = useState(false);

const handleImageError = () => {
setIsError(true);
};

return (
<StyledMemberImage
src={isError ? DefaultMemberImage : src}
alt={alt}
width={width}
height={height}
css={css}
onError={handleImageError}
/>
);
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@xodms0309 xodms0309 merged commit 158a142 into develop Jan 29, 2024
3 checks passed
@xodms0309 xodms0309 deleted the feat/issue-4 branch January 29, 2024 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

카톡 이미지 기본일 때 대체 이미지 삽입
2 participants