Merged
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 = () => ( | |||
Contributor
There was a problem hiding this comment.
ask;
4개의 아이콘을 피그마 svg import를 통해 파일로는 관리할 수 없는 상황이였을까요? 만약 관리할 수 있다면 파일 저장 및 import해서 해당 아이콘을 사용하면 좋을 것 같습니다.
Comment on lines
34
to
36
| const [isAllChecked, setIsAllChecked] = useState(false); | ||
| const [isTermsChecked, setIsTermsChecked] = useState(false); | ||
| const [isPrivacyChecked, setIsPrivacyChecked] = useState(false); |
Contributor
There was a problem hiding this comment.
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; |
Contributor
There was a problem hiding this comment.
p2;
객체로 수정하신다면 checkState.all 값이 있기때문에 따로 정의하지 않으셔도 될 것 같습니다.
Park-min-hyoung
approved these changes
Mar 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.