From e8b5b563486f1988a1dfaa3ac0bfe3138e320dde Mon Sep 17 00:00:00 2001 From: HyunWoo Choi <116826162+chhw130@users.noreply.github.com> Date: Sun, 10 Dec 2023 14:33:51 +0900 Subject: [PATCH] =?UTF-8?q?feat(signup):=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=ED=8E=98=EC=9D=B4=EC=A7=80,=20form=20=EA=B5=AC?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs:[#4, #5] --- component/form/SignUpForm.tsx | 272 ++++++++++++++++++++++++++++++++++ src/app/signup/page.tsx | 12 ++ 2 files changed, 284 insertions(+) create mode 100644 component/form/SignUpForm.tsx create mode 100644 src/app/signup/page.tsx diff --git a/component/form/SignUpForm.tsx b/component/form/SignUpForm.tsx new file mode 100644 index 0000000..b593953 --- /dev/null +++ b/component/form/SignUpForm.tsx @@ -0,0 +1,272 @@ +"use client"; +import { useForm } from "react-hook-form"; +import { + Box, + Button, + ButtonGroup, + Flex, + FormControl, + FormLabel, + Input, + Select, + Text, +} from "@chakra-ui/react"; +import { useParams, useRouter } from "next/navigation"; + +export type TokenType = string | string[] | undefined; + +const SignUpForm = () => { + const params = useParams(); + const token: TokenType = params?.token; + + /**회원가입 확인 모달창 */ + const { + register, + formState: { errors }, + handleSubmit, + getValues, + } = useForm(); + + const router = useRouter(); + + // const { signUpHandler, isLoading } = useSignUp(token); + + /**회원가입 form 제출시 */ + const onSubmit = async (data: any) => { + const year = Number(data.birth?.slice(0, 4)); + const date = new Date().getFullYear(); + const age = date - year + 1; + + const signUpInform = { + email: data.email, + password: data.password, + name: data.name, + nickname: data.nickname, + age: age, + phone: data.phone_number, + pick: Number(data.pick), + }; + + // await signUpHandler(signUpInform); + }; + + return ( + <> + + + <> + {/* */} + + + + 비밀번호 + + + {errors.password && ( + + {/* {errors.password.message} */} + + )} + + + + + 비밀번호 확인 + + + {errors.passwordConfirm && ( + + {/* {errors.passwordConfirm.message} */} + + )} + + + + + 이름 + + + {errors.name && ( + + {/* {errors.name.message} */} + + )} + + + + + 생년월일 + + + {errors.birth && ( + + {/* {errors.birth.message} */} + + )} + + + + + 닉네임 + + + {errors.birth && ( + + {/* {errors.birth.message} */} + + )} + + + + + 전화번호 + + + {errors.phone_number && ( + + {/* {errors.phone_number.message} */} + + )} + + + + + 최애 + + + + + + + + + + + + + ); +}; +export default SignUpForm; diff --git a/src/app/signup/page.tsx b/src/app/signup/page.tsx new file mode 100644 index 0000000..04d3767 --- /dev/null +++ b/src/app/signup/page.tsx @@ -0,0 +1,12 @@ +import React from "react"; +import SignUpForm from "../../../component/form/SignUpForm"; + +const page = () => { + return ( + <> + + + ); +}; + +export default page;