diff --git a/component/Funnel/LoginFunnel.tsx b/component/Funnel/LoginFunnel.tsx new file mode 100644 index 0000000..cfa4d77 --- /dev/null +++ b/component/Funnel/LoginFunnel.tsx @@ -0,0 +1,46 @@ +"use client"; +import { ButtonGroup, Text } from "@chakra-ui/react"; +import MainButton from "../button/MainButton"; +import Image from "next/image"; +import { useRouter } from "next/navigation"; + +const LoginFunnel = () => { + const router = useRouter(); + return ( + <> + 식선생 + + + {}}> + 다음으로 + + router.push("/signup")} + cursor={"pointer"} + > + 체험하기 + + + + ); +}; + +export default LoginFunnel; diff --git a/component/Funnel/MainFunnel.tsx b/component/Funnel/MainFunnel.tsx new file mode 100644 index 0000000..d1b92eb --- /dev/null +++ b/component/Funnel/MainFunnel.tsx @@ -0,0 +1,69 @@ +"use client"; +import { Box, ButtonGroup, Heading, Text } from "@chakra-ui/react"; +import Image from "next/image"; +import MainButton from "../../component/button/MainButton"; +import { useRouter } from "next/navigation"; +import { Dispatch, SetStateAction } from "react"; + +interface MainFunnelPropsType { + setFunnel: Dispatch>; +} + +const MainFunnel = ({ setFunnel }: MainFunnelPropsType) => { + const router = useRouter(); + + return ( + <> + 식선생 + + + 살빼려면 +
+ 오늘 얼마만큼 운동해야하지? +
+ + 오늘 먹은 음식을 식선생에게 외쳐보세요!
+ 필요 운동량과 안찌는 식단을 한번에 알려드려요 +
+
+ + + { + setFunnel("login"); + }} + > + 다음으로 + + + + ); +}; + +export default MainFunnel; diff --git a/src/app/page.tsx b/src/app/page.tsx index 879ef97..dcd5c3a 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,11 +1,11 @@ "use client"; -import { Box, ButtonGroup, Flex, Heading, Text } from "@chakra-ui/react"; -import MainButton from "../../component/button/MainButton"; -import { useRouter } from "next/navigation"; -import Image from "next/image"; +import { Flex } from "@chakra-ui/react"; +import { useFunnel } from "../../utils/hooks/useFunnel"; +import MainFunnel from "../../component/Funnel/MainFunnel"; +import LoginFunnel from "../../component/Funnel/LoginFunnel"; export default function Home() { - const router = useRouter(); + const { funnel, setFunnel } = useFunnel("main"); return ( - 식선생 - - - 살빼려면 -
- 오늘 얼마만큼 운동해야하지? -
- - 오늘 먹은 음식을 식선생에게 외쳐보세요!
- 필요 운동량과 안찌는 식단을 한번에 알려드려요 -
-
- - - { - router.push("/signup"); - }} - > - 다음으로 - - + {funnel === "main" && } + {funnel === "login" && }
); } diff --git a/src/app/signup/page.tsx b/src/app/signup/page.tsx index e8e4145..3531524 100644 --- a/src/app/signup/page.tsx +++ b/src/app/signup/page.tsx @@ -8,7 +8,7 @@ import UserAgreementForm from "../../../component/form/UserAgreementForm"; const Page = () => { const [progress, setProgress] = useState(33.3); - const { funnel, setFunnel } = useFunnel(); + const { funnel, setFunnel } = useFunnel("userInfo"); return ( <> { - const [funnel, setFunnel] = useState("userInfo"); +export const useFunnel = (state: string) => { + const [funnel, setFunnel] = useState(state); return { funnel, setFunnel }; };