diff --git a/src/components/Sign/SignIn/index.tsx b/src/components/Sign/SignIn/index.tsx index 46c5177..0cd3a83 100644 --- a/src/components/Sign/SignIn/index.tsx +++ b/src/components/Sign/SignIn/index.tsx @@ -7,7 +7,11 @@ type InputsType = { password: string; }; -function SignIn() { +type SignInPropsType = { + setIsSginUp: React.Dispatch>; +}; + +function SignIn({ setIsSginUp }: SignInPropsType) { // TODO: errors에 대한 다양한 유형 처리하기 (ex) 아이디가 없는 경우, 비밀번호가 틀린 경우 등) const { register, @@ -60,7 +64,14 @@ function SignIn() {

- 아직 회원이 아니신가요? 회원가입 + 아직 회원이 아니신가요?{' '} + { + setIsSginUp((pre) => !pre); + }} + > + 회원가입 +

diff --git a/src/components/Sign/SignUp/index.tsx b/src/components/Sign/SignUp/index.tsx index 5b7c107..317ffab 100644 --- a/src/components/Sign/SignUp/index.tsx +++ b/src/components/Sign/SignUp/index.tsx @@ -1,7 +1,115 @@ import React from 'react'; +import styles from './styles.module.scss'; +import { SubmitHandler, useForm } from 'react-hook-form'; -function SignUp() { - return
회원가입 컴포넌트
; +type SignUpPropsType = { + setIsSginUp: React.Dispatch>; +}; + +type InputsType = { + nickname: string; + id: string; + password: string; + passwordCheck: string; +}; + +function SignUp({ setIsSginUp }: SignUpPropsType) { + const { + register, + handleSubmit, + watch, + formState: { errors }, + } = useForm(); + + const onSubmit: SubmitHandler = async (data: InputsType) => { + console.info(data); + // TODO: 실제 로그인 로직을 수행하고, 서버로부터 JWT 토큰을 받는다. + }; + + return ( +
+
+
+ + + {errors.nickname && {errors.nickname.message}} +
+ +
+ + + {errors.id && {errors.id.message}} +
+
+ + + {errors.password && {errors.password.message}} +
+ +
+ + + {errors.passwordCheck && {errors.passwordCheck.message}} +
+ + +

+ 아이디가 기억나셨나요?{' '} + { + setIsSginUp((pre) => !pre); + }} + > + 로그인 + +

+
+
+ ); } export default SignUp; diff --git a/src/components/Sign/SignUp/styles.module.scss b/src/components/Sign/SignUp/styles.module.scss new file mode 100644 index 0000000..8330ad4 --- /dev/null +++ b/src/components/Sign/SignUp/styles.module.scss @@ -0,0 +1,74 @@ +.container { + display: flex; + flex-direction: column; + align-items: center; + gap: 3rem; + background-color: white; +} + +.form { + display: flex; + flex-direction: column; + width: 100%; + gap: 2rem; + & > div { + display: flex; + flex-direction: column; + + & > label { + margin-bottom: 1rem; + } + & > input { + @media screen and (max-width: 768px) { + height: auto; + padding: 3rem 1.5rem; + } + width: 100%; + height: 4.9rem; + padding: 0 1.5rem; + margin-bottom: 1rem; + font-weight: 500; + outline: none; + background: #f9f9f9; + box-shadow: 0px 1px 2px 3px rgba(0, 0, 0, 0.15), + 0px 1px 1px rgba(0, 0, 0, 0.3); + border-radius: 4px; + } + & > span { + color: red; + font-size: 1.2rem; + } + } + + & > button { + align-self: center; + width: 18rem; + height: 4.9rem; + margin-top: 5rem; + cursor: pointer; + color: white; + border: none; + background: #ff6835; + border-radius: 100px; + &:hover { + opacity: 0.8; + } + } + + & > p { + align-self: center; + margin-top: 1rem; + font-size: 1.4rem; + color: #cecece; + + & > span { + font-weight: 600; + cursor: pointer; + color: #ff6835; + &:hover { + text-decoration: underline; + opacity: 0.8; + } + } + } +} diff --git a/src/pages/sign/index.tsx b/src/pages/sign/index.tsx index 1d83674..87e653c 100644 --- a/src/pages/sign/index.tsx +++ b/src/pages/sign/index.tsx @@ -1,15 +1,21 @@ -import React from 'react'; +import React, { useState } from 'react'; import { Player } from '@lottiefiles/react-lottie-player'; import styles from './styles.module.scss'; import SignIn from '@/components/Sign/SignIn'; +import SignUp from '@/components/Sign/SignUp'; function SignPage() { + const [isSignUp, setIsSginUp] = useState(false); return (

HQ Rutine

- + {isSignUp ? ( + + ) : ( + + )}