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: ✨ LevelModal 컴포넌트 이관 #98

Merged
merged 10 commits into from
Jul 26, 2022
Merged

Conversation

hy57in
Copy link
Contributor

@hy57in hy57in commented Jul 23, 2022

📍 주요 변경사항

  • LevelModal 컴포넌트 이관
  • css 디자인에 맞게 수정
  • mypage 하위에 작성

image

🔗 참고자료

💡 중점적으로 봐주었으면 하는 부분

@hy57in hy57in requested a review from cyjo9603 as a code owner July 23, 2022 19:52
@hy57in hy57in self-assigned this Jul 23, 2022
@hy57in hy57in requested a review from syoung125 as a code owner July 23, 2022 19:52
@hy57in hy57in linked an issue Jul 23, 2022 that may be closed by this pull request
Comment on lines 17 to 19
if (!levelData) {
return null;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

levelData는 필수값인데 해당 로직은 필요없을 것 같습니다.
levelData이 실제로 optional 한 데이터라면 타입을 optional로 변경하거나, 외부에서 levelData라는 타입을 정확히 명시해
해당 데이터가 있어야 LevelModal 컴포넌트를 렌더링해주는게 좀 더 type safe한것 같습니다.

그리고 levelData라는 변수명도 다른 pr comment와 마찬가지로 array인지 알 수 있는 변수명이면 좋을것 같고 data라는 postfix없이도 의미는 명확하게 지을 수 있을 것 같아요

Comment on lines 78 to 80
const CloseIcon = styled(Icon)`
cursor: pointer;
`;
Copy link
Contributor

Choose a reason for hiding this comment

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

전체적으로 Icon에 cursor: pointer 스타일을 오버라이딩해서 사용하는 경우가 많은것 같은데, 이러면 그냥 cursor props를 하나 추가해도 좋을 것 같습니다

@hy57in hy57in requested review from cyjo9603 and syoung125 July 24, 2022 09:24
@hy57in hy57in linked an issue Jul 24, 2022 that may be closed by this pull request
openModal?: () => void;
closeModal?: () => void;
open: boolean;
setOpen?: () => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

openModal과 setOpen은 불필요한 prop인 것 같고, 코드상에 사용되는 부분이 없어보이는데
전달받아야하는 이유가 있나요??

Copy link
Contributor Author

@hy57in hy57in Jul 26, 2022

Choose a reason for hiding this comment

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

Modal 컴포넌트를 옮기는 과정에서 중복되는 prop이 생긴것 같아 정리하였습니다!
불필요하게 중복되는 prop은 제거하고, 네이밍을 통일했습니다
a292574

{title && <Title>{title}</Title>}
{description && <Description>{description}</Description>}
{buttons && <ButtonContainer>{buttons}</ButtonContainer>}
{noMoreSee && <NoMoreSee onClick={closeModal}>다시 보지 않기</NoMoreSee>}
Copy link
Contributor

Choose a reason for hiding this comment

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

다시보지 않기의 onClick 이벤트가 closeModal만 들어가는것이 맞을까용..?
스토리지에 상태 저장 등 다른 로직이 포함될 여지가 있어보여서 onNoMoreSee Prop을 추가하거나
아예 공통 Modal 컴포넌트에서는 이부분이 없어도 될것같아요 (필요할때만 children으로 추가)

Copy link
Contributor Author

@hy57in hy57in Jul 26, 2022

Choose a reason for hiding this comment

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

넵 noMoreSee prop은 공통 Modal에 있기에 적합하지 않다는 의견에 동의합니다
noMoreSee 는 홈 화면의 모달에서만 사용되니 Modal 컴포넌트를 래핑한 홈 화면 전용 모달을 따로 만드는게 좋을 것 같아요

이 PR은 LevelModal 컴포넌트를 만들면서 필요한 Modal 컴포넌트를 이관한 것이니, 홈 화면 전용 모달을 만들때 NoMoreSee 부분을 리팩토링하면 좋을 것 같아요

Copy link
Contributor

Choose a reason for hiding this comment

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

넵넵! 이슈나 투두 주석 작성해두면 좋을 것 같아요~

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#104 (comment) 추가했어요!

@@ -14,13 +12,19 @@ interface Props {
}

const LevelModal = ({ isLevelModalOpen, closeLevelModal, levels }: Props) => {
const [isModalOpen, setIsModalOpen] = useState(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

여기 내부의 isModalOpen과 isLevelModalOpen상태는 어떻게 다른건가요??

@hy57in hy57in requested a review from syoung125 July 26, 2022 08:16
@syoung125
Copy link
Contributor

효진님 스토리북에서 에러발생하나보네요! @hy57in

Copy link
Contributor

@syoung125 syoung125 left a comment

Choose a reason for hiding this comment

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

크ㅡ👍👍

@hy57in hy57in merged commit 5fea20b into develop Jul 26, 2022
@hy57in hy57in deleted the feature/level-modal branch July 26, 2022 13:17
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.

Modal 컴포넌트 이관 LevelModal 컴포넌트 이관
3 participants