Skip to content

Commit b634e8d

Browse files
committed
Merge branch 'develop'
2 parents 3efbb9b + 30ec86d commit b634e8d

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

src/components/errorText/ErrorText.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const ErrorTextMessage = styled.span`
1919
font-family: "pretendardB";
2020
font-size: 18px;
2121
`;
22+
2223
const ErrorText = ({ text }) => {
2324
return (
2425
<ErrorTextContainer>

src/components/header/nav/Nav.jsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ import useHover from "../../../hooks/useHover";
55
import { useLocation, useNavigate } from "react-router-dom";
66
import GoToLocationModalContents from "../../modal/modalContents/GoToMainModalContents";
77
import Modal from "../../modal/Modal";
8-
import { useSetAtom } from "jotai";
9-
import { timerControlAtom } from "../../../store/atom";
8+
import { useSetAtom, useAtomValue } from "jotai";
9+
import {
10+
timerControlAtom,
11+
userNameAtom,
12+
userNameErrorAtom
13+
} from "../../../store/atom";
1014

1115
/*네비게이터 전체 */
1216
const NavBorderBottom = styled.div`
@@ -97,8 +101,14 @@ const Nav = () => {
97101
const setTimerControl = useSetAtom(timerControlAtom);
98102
const path = useLocation().pathname;
99103
const nav = useNavigate();
104+
const userName = useAtomValue(userNameAtom);
105+
const setUserNameError = useSetAtom(userNameErrorAtom);
100106

101107
const handleClick = () => {
108+
if (userName === "") {
109+
setUserNameError(true);
110+
return;
111+
}
102112
setTimerControl(false);
103113
if (path.includes("step") && !path.includes("step0")) {
104114
setIsConfirm(true);

src/pages/challengeMode/components/AgreementMelon.jsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React, { useEffect } from "react";
12
import styled from "styled-components";
23
import ErrorText from "../../../components/errorText/ErrorText";
34

@@ -61,6 +62,13 @@ const AgreeMentMelon = ({
6162
)
6263
);
6364
};
65+
66+
useEffect(() => {
67+
// every 함수로 배열의 모든 요소가 조건을 충족하는지 확인
68+
const allChecked = isAgree.every((item) => item === true);
69+
setIsAgreeAll(allChecked);
70+
}, [isAgree, setIsAgreeAll]);
71+
6472
// 전체 동의를 하지 않은 상태에서 다음 단계 버튼을 클릭했을 경우
6573
const hasError = errorArray.includes("checkbox");
6674

@@ -72,7 +80,12 @@ const AgreeMentMelon = ({
7280
{hasError && <ErrorText text="체크박스에 모두 동의해 주세요" />}
7381
</TextBox>
7482
<CheckboxContainer>
75-
<input type="checkbox" id="agreeAll" onClick={handleAgreeAll} />
83+
<input
84+
type="checkbox"
85+
id="agreeAll"
86+
checked={isAgreeAll} // 모두 체크되면 전체 동의도 체크하기
87+
onClick={handleAgreeAll}
88+
/>
7689
<CheckboxLabel htmlFor="agreeAll">전체동의</CheckboxLabel>
7790
<Info>전체 동의를 누르면 한 번에 동의처리됩니다.</Info>
7891
</CheckboxContainer>

0 commit comments

Comments
 (0)