-
Notifications
You must be signed in to change notification settings - Fork 0
feat:약관동의 및 휴대폰번호 입력 #16
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 locationcheckgo ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
| @@ -0,0 +1,93 @@ | |||
| export const UncheckedAllIcon = () => ( | |||
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.
ask;
4개의 아이콘을 피그마 svg import를 통해 파일로는 관리할 수 없는 상황이였을까요? 만약 관리할 수 있다면 파일 저장 및 import해서 해당 아이콘을 사용하면 좋을 것 같습니다.
| const [isAllChecked, setIsAllChecked] = useState(false); | ||
| const [isTermsChecked, setIsTermsChecked] = useState(false); | ||
| const [isPrivacyChecked, setIsPrivacyChecked] = useState(false); |
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.
p2;
해당 상태들을 객체로 관리하면 좋을 것 같습니다. 지금 handleAllCheck가 호출될 경우 3개의 상태가 업데이트되 3번에 리렌더링이 되어서 렌더링에 있어 보완이 필요할 것 같습니다. 더불어 객체로 관리하면 get 및 set하기가 용이할 것 같습니다. 아래 코드는 참조용 코드입니다.
const [checkState, setCheckState] = useState({
all: false,
terms: false,
privacy: false
});
전체 체크 및 개별 체크 로직
// 전체 체크
const handleAllCheck = () => {
setCheckState((prev) => {
const newChecked = !prev.all;
return {
all: newChecked,
terms: newChecked,
privacy: newChecked
};
});
};
// 개별 체크
const handleSingleCheck = (key: 'terms' | 'privacy') => {
setCheckState((prev) => {
const newState = {
...prev,
[key]: !prev[key]
};
// 모든 체크박스가 체크되면 "all"도 true로 맞춤
newState.all = newState.terms && newState.privacy;
return newState;
});
};
| const handleTermsCheck = () => setIsTermsChecked((prev) => !prev); | ||
| const handlePrivacyCheck = () => setIsPrivacyChecked((prev) => !prev); | ||
|
|
||
| const isNextEnabled = isTermsChecked && isPrivacyChecked; |
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.
p2;
객체로 수정하신다면 checkState.all 값이 있기때문에 따로 정의하지 않으셔도 될 것 같습니다.
No description provided.