diff --git a/component/form/UserAgreementForm.tsx b/component/form/UserAgreementForm.tsx index e53b4a0..d8c98f7 100644 --- a/component/form/UserAgreementForm.tsx +++ b/component/form/UserAgreementForm.tsx @@ -11,14 +11,17 @@ import MainButton from "../button/MainButton"; interface UserAgreementFormPropsType { setFunnel: React.Dispatch>; + setProgress: React.Dispatch>; } -const UserAgreementForm = ({ setFunnel }: UserAgreementFormPropsType) => { +const UserAgreementForm = ({ + setFunnel, + setProgress, +}: UserAgreementFormPropsType) => { const [checkedItems, setCheckedItems] = useState([false, false, false]); const allChecked = checkedItems.every(Boolean); const isIndeterminate = checkedItems.some(Boolean) && !allChecked; - console.log(); return ( <> @@ -116,8 +119,12 @@ const UserAgreementForm = ({ setFunnel }: UserAgreementFormPropsType) => { w={"100%"} h={"52px"} isDisabled={checkedItems.filter((ele) => ele).length !== 3} + onClick={() => { + setFunnel("userInfo"); + setProgress((oldState) => oldState + 33.3); + }} > - 동의하고 시작하기 + 다음으로 diff --git a/component/form/UserInfoForm.tsx b/component/form/UserInfoForm.tsx index 590fcc8..ba9320a 100644 --- a/component/form/UserInfoForm.tsx +++ b/component/form/UserInfoForm.tsx @@ -13,6 +13,7 @@ import { import MainInput from "../input/MainInput"; import MainButton from "../button/MainButton"; import { SubmitHandler, useForm } from "react-hook-form"; +import { UserInfoType } from "@/app/signup/page"; function RadioCard(props: any) { const { getInputProps, getRadioProps } = useRadio(props); @@ -48,9 +49,14 @@ function RadioCard(props: any) { interface UserInfoFormPropsType { setFunnel: React.Dispatch>; setProgress: React.Dispatch>; + setUserInfo: React.Dispatch>; } -const UserInfoForm = ({ setFunnel, setProgress }: UserInfoFormPropsType) => { +const UserInfoForm = ({ + setFunnel, + setProgress, + setUserInfo, +}: UserInfoFormPropsType) => { const options = ["남성", "여성"]; const { getRootProps, getRadioProps, value } = useRadioGroup({ @@ -65,6 +71,7 @@ const UserInfoForm = ({ setFunnel, setProgress }: UserInfoFormPropsType) => { const onSubmit: SubmitHandler = (data) => { console.log(data, value); + setFunnel("userPhysics"); setProgress((oldState) => oldState + 33.3); }; diff --git a/src/app/signup/page.tsx b/src/app/signup/page.tsx index e5cacab..ea51706 100644 --- a/src/app/signup/page.tsx +++ b/src/app/signup/page.tsx @@ -7,9 +7,26 @@ import UserPhysicForm from "../../../component/form/UserPhysicForm"; import UserAgreementForm from "../../../component/form/UserAgreementForm"; import { SubmitHandler, useForm } from "react-hook-form"; +export interface UserInfoType { + userName: string; + gender: string; + age: number; + height: number; + weight: number; + targetWeight: number; +} + const Page = () => { const [progress, setProgress] = useState(33.3); - const { funnel, setFunnel } = useFunnel("userInfo"); + const [userInfo, setUserInfo] = useState({ + userName: "", + gender: "", + age: 0, + height: 0, + weight: 0, + targetWeight: 0, + }); + const { funnel, setFunnel } = useFunnel("userAgreement"); return ( <> @@ -20,6 +37,7 @@ const Page = () => { isAnimated={true} value={progress} /> + { margin={"0 auto"} alignItems={"center"} > + {funnel === "userAgreement" && ( + + )} {funnel === "userInfo" && ( - + )} {funnel === "userPhysics" && ( )} - {funnel === "userAgreement" && ( - - )} );