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

[회원가입] 회원가입 페이지 유저 데이터 입력 로직 구현 및 api 연동 #15

Merged
merged 56 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
b0c71f1
refactor: progress bar component/common으로 이동
HAEROOL May 10, 2023
c83b607
feat: 약관동의 페이지 약관동의 로직 추가
HAEROOL May 16, 2023
dd91397
feat: 비밀번호 중복확인 로직 추가
HAEROOL Jun 4, 2023
ee9ef0b
feat: 비밀번호 보기 버튼 로직 추가
HAEROOL Jun 4, 2023
5cd98dd
feat: 커스텀 버튼 사이즈, submit/button 타입 추가
HAEROOL Jun 5, 2023
6b2a57d
feat: 이메일 입력 폼 로직 추가
HAEROOL Jun 5, 2023
ba16115
style: id인풋 스타일 변경
HAEROOL Jun 6, 2023
45f9612
feat: useVisible 훅 분리
HAEROOL Jun 6, 2023
2bdea2c
feat: 비밀번호 가시화 버튼 로직 수정
HAEROOL Jun 7, 2023
c36cc09
refactor: id 인풋 레이아웃 수정
HAEROOL Jun 7, 2023
1c222a3
fix: 버튼 props 이름 수정
HAEROOL Jun 13, 2023
2e4ff97
feat: 비밀번호 확인 로직 추가
HAEROOL Jun 13, 2023
700be74
refactor: console.log 삭제
HAEROOL Jun 14, 2023
13b2c82
feat: 인증번호 입력 인풋 렌더링 조건 추가
HAEROOL Jun 14, 2023
51274d9
feat: 유저 id 입력 인풋 type 지정
HAEROOL Jun 26, 2023
4f62664
feat: 유저 회원가입 데이터 비밀번호 값 타입 지정
HAEROOL Jun 26, 2023
198a82c
feat: 이메일 인증 로직 구현
HAEROOL Jul 1, 2023
9135ca1
feat: 다음 버튼 로직 추가
HAEROOL Jul 1, 2023
df8e276
feat: zod 회원가입용 스키마 추가
HAEROOL Jul 1, 2023
f77d827
Merge branch 'develop' into feature/add-signup-page
HAEROOL Jul 1, 2023
3cf46d3
feat: 모바일용 id입력 인풋 로직 추가
HAEROOL Jul 5, 2023
f9cb54d
refactor: 모바일 뷰와 pc 뷰의 step 단위 결합
HAEROOL Jul 6, 2023
32902f7
fix: 모바일 뷰 뒤로가기 버튼 로직 수정
HAEROOL Jul 6, 2023
87ca52f
feat: 모바일 뷰 id 중복확인 버튼 제거
HAEROOL Jul 6, 2023
50dbd2d
feat: 모바일 뷰 이메일 인증번호 로직 추가
HAEROOL Jul 7, 2023
42bc000
refactor: console.log 제거
HAEROOL Jul 7, 2023
d0dd400
fix: 모바일 뷰 인증번호 입력 페이지 뒤로가기 안되는 버그 수정
HAEROOL Jul 7, 2023
c8bed61
feat: 인증번호 입력 실패 시 에러 문구 출력
HAEROOL Jul 7, 2023
4da1621
feat: 이메일 중복 확인 api 연결 및 관련 커스텀 훅 추가
HAEROOL Jul 9, 2023
8a831f1
feat: 에러 후 다른 이메일 입력 시에 에러 문구 없어지도록 변경
HAEROOL Jul 9, 2023
2ce1a99
feat: 이메일 인증 요청 api 추가
HAEROOL Jul 10, 2023
883d33a
feat: 이메일 코드 인증 api 연결
HAEROOL Jul 10, 2023
0bf246e
feat: 이메일 인증 완료 시 인증 버튼 비활성화
HAEROOL Jul 10, 2023
3608c39
feat: upload token을 위한 uploadTokenStore 추가
HAEROOL Jul 10, 2023
ad1699e
refactor: 에러메시지 컴포넌트 분리
HAEROOL Jul 10, 2023
d1c71bc
refactor: 에러메세지 변수명 변경
HAEROOL Jul 11, 2023
d952755
Merge branch 'develop' into feature/add-signup-page
HAEROOL Jul 11, 2023
3facbef
refactor: console.log 제거
HAEROOL Jul 11, 2023
2272af9
feat: 이메일 인증 모바일 뷰 다음 버튼 로직 구현
HAEROOL Jul 11, 2023
bef5cc3
fix: 모바일 뷰 다음 버튼 로직 pc 뷰에서 예외처리
HAEROOL Jul 11, 2023
ba9e0d0
feat: 중복되지 않는 id일시에 id 인풋 disabled 처리
HAEROOL Jul 12, 2023
dfeecfa
refactor: 이메일 중복 체크 api request, response model 변수명 변경
HAEROOL Jul 12, 2023
a92dbc5
refactor: useGenerateAuthCode query key 오타 수정
HAEROOL Jul 12, 2023
7dc36a2
style: y축 스크롤 스타일 제거
HAEROOL Jul 12, 2023
b6e144c
refactor: 뒤로가기 버튼 common의 PreviousStep으로 변경
HAEROOL Jul 12, 2023
c8d744d
feat: 약관 모두 동의 시 스크롤 최하단으로 이동하는 기능 추가
HAEROOL Sep 25, 2023
39844b8
feat: 회원가입 다음단계 클릭시 스크롤 최상단으로 이동
HAEROOL Sep 25, 2023
a26c871
refactor: IE 관련 CSS 제거
HAEROOL Sep 25, 2023
29d9d0b
refactor: custombutton 타입 수정
HAEROOL Sep 25, 2023
9b18486
refactor: 오타수정
HAEROOL Sep 25, 2023
329cc4f
styles: 에러메시지 height 수정
HAEROOL Sep 25, 2023
c3be5fa
fix: 정규표현식 만족시 바로 다음 입력으로 넘어가는 오류 수정
HAEROOL Sep 25, 2023
a7b603a
Merge branch 'develop' into feature/add-signup-page
HAEROOL Oct 22, 2023
adba3ab
Merge branch 'develop' into feature/add-signup-page
HAEROOL Oct 22, 2023
7b92564
refactor: customButton buttonType => buttonSize로 속성명 변경
HAEROOL Oct 23, 2023
493e384
fix: 비밀번호 input 정규표현식 만족 시 바로 다음으로 넘어가는 버그 수정
HAEROOL Oct 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
]
},
"devDependencies": {
"@types/react": "^18.2.8",
HAEROOL marked this conversation as resolved.
Show resolved Hide resolved
"@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/parser": "^5.30.0",
"eslint": "^8.18.0",
Expand Down
19 changes: 19 additions & 0 deletions src/api/register/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { client } from 'api';
import {
AuthCodeParam, AuthCodeResponse, EmailRegisterParam, EmailRegisterResponse,
} from 'model/register';

export const getEmailDuplicate = async (param: string) => {
const { status } = await client.get(`/user/check/email?address=${param}`);
return status;
};

export const getEmailAuthCode = async (param: EmailRegisterParam) => {
const { data } = await client.post<EmailRegisterResponse>('/owners/verification/email', param);
return EmailRegisterResponse.parse(data);
};

export const verificationAuthCode = async (param:AuthCodeParam) => {
const { data } = await client.post<AuthCodeResponse>('/owners/verification/code', param);
return AuthCodeResponse.parse(data);
};
28 changes: 28 additions & 0 deletions src/model/register/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { z } from 'zod';

export const EmailRegisterParam = z.object({
address: z.string().email(),
});
export type EmailRegisterParam = z.infer<typeof EmailRegisterParam>;

export const EmailRegisterResponse = z.string();
export type EmailRegisterResponse = z.infer<typeof EmailRegisterResponse>;

export const AuthCodeParam = z.object({
address: z.string().email(),
certification_code: z.string(),
});
export type AuthCodeParam = z.infer<typeof AuthCodeParam>;

export const AuthCodeResponse = z.object({
token: z.string(),
});
export type AuthCodeResponse = z.infer<typeof AuthCodeResponse>;

export const RegisterParam = z.object({
email: z.string(),
password: z.string(),
isAuthentication: z.boolean().refine((value) => value === true),
});

export type RegisterParam = z.infer<typeof RegisterParam>;
6 changes: 5 additions & 1 deletion src/page/Auth/Signup/SignUp.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@

@include media.media-breakpoint-down(mobile) {
width: 78%;
height: 80vh;
height: 79vh;
margin-bottom: 60px;
overflow-y: scroll;
scrollbar-width: none; /* 파이어폭스 */
&::-webkit-scrollbar {
display: none;
}
}

&__steps {
Expand Down
9 changes: 5 additions & 4 deletions src/page/Auth/Signup/component/CustomButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ import styles from './CustomButton.module.scss';

interface ButtonProps {
content:string,
buttonType:string,
buttonSize: 'small' | 'mobile' | 'large',
disable?: boolean,
submit?:boolean
onClick?: () => void
}

export default function CustomButton({
content, buttonType, disable, onClick,
content, buttonSize, disable, onClick, submit,
}:ButtonProps) {
return (
<button
type="button"
className={`${styles[`button--${buttonType}`]}`}
type={submit ? 'submit' : 'button'}
HAEROOL marked this conversation as resolved.
Show resolved Hide resolved
className={`${styles[`button--${buttonSize}`]}`}
onClick={onClick}
disabled={!!disable}
>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.warn {
display: flex;
align-items: center;
margin-top: 9px;
padding-bottom: 16px;
gap: 7px;
height: 11px;

&--phrase {
display: block;
color: #f05d3d;
font-size: 11px;
}
}
15 changes: 15 additions & 0 deletions src/page/Auth/Signup/component/ErrorMessage/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { ReactComponent as Warn } from 'assets/svg/auth/warning.svg';
import styles from './ErrorMessage.module.scss';

interface ErrorMessageProps {
message: string | undefined
}

export default function ErrorMessage({ message }:ErrorMessageProps) {
return (
<div className={styles.warn}>
<Warn />
<span className={styles['warn--phrase']}>{message}</span>
</div>
);
}
21 changes: 21 additions & 0 deletions src/page/Auth/Signup/component/UserEmail/UserEmail.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,27 @@
font-size: 18px;
}

&__warn {
HAEROOL marked this conversation as resolved.
Show resolved Hide resolved
display: flex;
align-items: center;
margin-top: 9px;
margin-bottom: 16px;
gap: 7px;
height: 11px;

&--phrase {
display: block;
color: #f05d3d;
font-size: 11px;
}
}

&__input {
width: calc(100% - 2px);
display: flex;
flex-direction: column;
margin-top: 8px;
margin-bottom: 16px;
gap: 8px;
}

Expand All @@ -20,6 +36,11 @@
height: calc(48px - 30px);
padding: 14px 16px;

&::-webkit-inner-spin-button {
appearance: none;
margin: 0;
}

@include media.media-breakpoint-down(mobile) {
width: 100%;
margin-top: 31px;
Expand Down
63 changes: 51 additions & 12 deletions src/page/Auth/Signup/component/UserEmail/index.tsx
Original file line number Diff line number Diff line change
@@ -1,42 +1,81 @@
import useMediaQuery from 'utils/hooks/useMediaQuery';
import CustomButton from 'page/Auth/Signup/component/CustomButton';
import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
import useValidateEmail from 'page/Auth/Signup/hooks/useValidateEmail';
import useAuthCheck from 'page/Auth/Signup/hooks/useAuthCheck';
import useVerification from 'page/Auth/Signup/hooks/useVerification';
import ErrorMessage from 'page/Auth/Signup/component/ErrorMessage';
import styles from './UserEmail.module.scss';

type ButtonClickEvent = {
clickEvent?: () => void | null
goNext?: () => void;
userData: RegisterData,
setAuthenticate: (data:RegisterData) => void
};
export default function UserEmail({ clickEvent }:ButtonClickEvent) {

export default function UserEmail({ userData, setAuthenticate }:ButtonClickEvent) {
const { isMobile } = useMediaQuery();
const {
emailHandleSubmit, errors: formErrors, emailDuplicateRegister, watch,
} = useValidateEmail();
const {
isOpen, onSubmit, errorMessage: requestError, email, refetch,
} = useAuthCheck(userData.email ? userData.email : '', isMobile);
const {
verificationCode,
codeInput, errorMessage: verificateError,
} = useVerification(email, setAuthenticate, userData);

return (
!isMobile
? (
<div className={styles['email-check']}>
<form className={styles['email-check']} onSubmit={emailHandleSubmit(onSubmit)}>
<span className={styles['email-check__label']}>이메일 인증</span>
<div className={styles['email-check__input']}>
<input className={styles.input} type="text" placeholder="이메일 입력@example.com" />
<input className={styles.input} type="text" placeholder="인증번호" />
<input className={styles.input} type="text" placeholder="이메일 입력@example.com" {...emailDuplicateRegister} disabled={isOpen} />
{isOpen && <input className={styles.input} type="text" pattern="\d*" maxLength={6} placeholder="인증번호" ref={codeInput} disabled={userData.isAuthentication} />}
</div>
<span className={styles['email-check__alert']}>* 제한시간 5 : 00</span>
<CustomButton buttonType="large" content="인증번호 발송" />
</div>
{ formErrors.email && <ErrorMessage message={formErrors.email.message} />}
{(!formErrors.email && requestError && email === watch().email)
&& <ErrorMessage message={requestError} />}
{ verificateError && <ErrorMessage message={verificateError} />}
{isOpen ? (
<>
<span className={styles['email-check__alert']}>* 제한시간 5 : 00</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

이메일을 보내면 제한시간이 줄어드는 기능 구현이 필요해 보입니다!

<CustomButton
buttonSize="large"
content="인증완료"
onClick={verificationCode}
disable={userData.isAuthentication}
/>
</>
) : (
<CustomButton
buttonSize="large"
content="인증번호발송"
submit
/>
)}
</form>
)
: (
<>
<div className={styles['email-check']}>
<span className={styles['email-check__phrase']}>
<span className={styles['email-check__phrase--user-email']}>[email protected]</span>
<span className={styles['email-check__phrase--user-email']}>{userData.email}</span>
&nbsp;으로
<br />
발송된 인증번호 6자리를 입력해 주세요
</span>
<div className={styles['email-check__input']}>
<input className={styles.input} type="password" placeholder="인증번호 입력" />
<input className={styles.input} type="password" pattern="\d*" maxLength={6} placeholder="인증번호 입력" ref={codeInput} />
</div>
{verificateError && <ErrorMessage message={verificateError} />}
<span className={styles['email-check__alert']}>* 제한시간 5 : 00</span>
</div>
<div className={styles.buttons}>
<CustomButton buttonType="mobile" content="재발송" onClick={() => { alert('재발송'); }} />
<CustomButton buttonType="mobile" content="다음" onClick={clickEvent} />
<CustomButton buttonSize="mobile" content="재발송" onClick={refetch} />
<CustomButton buttonSize="mobile" content="다음" onClick={verificationCode} />
</div>
</>
)
Expand Down
44 changes: 19 additions & 25 deletions src/page/Auth/Signup/component/UserId/UserId.module.scss
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
@use "src/utils/styles/mediaQuery" as media;

.form {
height: 100px;

@include media.media-breakpoint-down(mobile) {
height: 50px;
}

&__label {
display: block;
font-size: 18px;
}

&__alert {
display: block;
margin-top: 8px;
margin-left: 8px;
height: 11px;
color: #858585;
font-size: 12px;
font-size: 11px;
margin-top: 9px;

// @include media.media-breakpoint-down(mobile) {
// margin: 0;
// }
}

&__warn {
display: flex;
align-items: center;
margin-top: 9px;
gap: 7px;
height: 11px;

&--phrase {
display: block;
Expand All @@ -31,10 +42,14 @@
.input-block {
display: flex;
width: calc(100% - 2px);
justify-content: space-between;
gap: 16px;
justify-content: space-between;
margin-top: 8px;

@include media.media-breakpoint-down(mobile) {
align-items: end;
}

&__input {
width: calc(100% - 32px - 80px);
border: 1px solid #d2dae2;
Expand All @@ -54,26 +69,5 @@
border-bottom: 1px solid black;
}
}

&--warn {
width: calc(100% - 32px - 80px);
border: 1px solid #d2dae2;
height: calc(48px - 30px);
padding: 14px 16px;

@include media.media-breakpoint-down(mobile) {
width: 100%;
padding: 0;
padding-bottom: 8px;
font-size: 15px;
border: none;
border-bottom: 1px solid #f05d3d;
outline: none;

&:focus {
border-bottom: 1px solid black;
}
}
}
}
}
Loading