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 1. custom hook 추가 (scheduleAdd component) 2. 모달 열기방식 수정(테스트로 kebob modal만 작업) #218

Merged
merged 3 commits into from
May 1, 2023

Conversation

AngelaChaejung
Copy link
Collaborator

@AngelaChaejung AngelaChaejung commented Apr 27, 2023

  1. scheduleAdd 컴포넌트에 카드색상 선택시 border색상을 주는 부분이 상태가 굉장히 많고 하드코딩된 부분이 있었습니다. 불필요하게 중복되는 코드를 줄이기 위해 custom hook으로 만들었습니다. (useCardColorSelector.jsx)

  2. ScheduleDetail컴포넌트 변경사항 보시면

{modalOpen&&...}

KebobModal을 여는 상태값을 scheduleDetail에서 논리연산자로 Kebob을 열지 말지 결정하고있었는데
scheduelDeail이 아닌, KebobModal컴포넌트 내에서 modalOpen여부에 따라 열지 말지 결정하는 방식으로 바꿨습니다.
기존의 코드대로 모달을 컨트롤하는게 일반적인 방식이지만 이렇게 수정한 이유는 상위컴포넌트에선 항상 컴포넌트를 열어두고, KebobModal.jsx내에서 보여줄지의 여부를 결정함으로써 모달 내의 상태를 초기값으로 reset할 수 있기 때문입니다.
현재 Kebob모달에서는 input이나 다른 특별한 state가 없긴하지만 참여자선택 followList모달과 같이 모달 내에 state가 존재하고있어서 열고 닫을 때마다 상태를 초기화해야할 땐 이런 방식으로 하면 좋다고 합니다! 오늘은 공부하면서 kebob에만 적용했고 차차 다른 모달에도 적용해볼게요

#217

@AngelaChaejung AngelaChaejung changed the title Refactor 1. custom hook 추가 (scheduleAdd component) 2. 모달 열기방식 수정(테스트로 kebob modal만 작업) Refactor 1. custom hook 추가 (scheduleAdd component) 2. 모달 열기방식 수정(테스트로 kebob modal만 작업) Apr 27, 2023
@dong-fa dong-fa merged commit 0b131b9 into gnims-project:dev May 1, 2023
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.

2 participants