-
Notifications
You must be signed in to change notification settings - Fork 4
[feat] 공통 컴포넌트 구현 (Post) #26
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
Conversation
✅ Deploy Preview for thejulge1 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
cozy-ito
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.
고생하셨습니다! 👍
src/components/Post/PostListItem.tsx
Outdated
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.
Post나 PostItem으로 표현해도 좋을 것 같아요! 😄
src/components/Post/PostListItem.tsx
Outdated
| <div | ||
| className="w-full h-[84px] overflow-hidden rounded-xl bg-cover bg-center md:h-40" | ||
| style={{ backgroundImage: `url(${imageUrl})` }} | ||
| /> |
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.
나중에 진행하실 태스크로 두셔도 좋을 것 같은데,
카드 컴포넌트의 이미지는 img 태그로 사용하면 좋을 것 같아요! 🤔
이미지 로딩 중에 img 태그의 onLoad, onError 메서드 들을 활용해서 대체 이미지를 렌더링 해주면
사용자 경험 개선에 더 좋을 것 같아요! 👍
사용 예시 코드도 남겨봅니다 😄
const CardImage = ({
src,
...
}: CardImageProps) => {
const [imageStatus, setImageStatus] = useState<
"loading" | "error" | "loaded"
>("loading");
const handleLoadImage = () => {
setImageStatus("loaded");
};
const handleLoadErrorImage = () => {
setImageStatus("error");
};
return (
<div>
{imageStatus === "loading" && (
<img src={"로딩 스피너 경로"} />
)}
{imageStatus === "error" && (
<img src={"대체 이미지 경로"} />
)}
<img
src={src}
onLoad={handleLoadImage}
onError={handleLoadErrorImage}
/>
</div>
);
};
almighty55555
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.
수고하셨습니다! 코드를 읽어놓고 승인을 잊고있었네요...
#️⃣연관된 이슈
📝 PR 유형
📝작업 내용
스크린샷 (선택)
💬리뷰 요구사항(선택)