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

feat(funnel) : useFunnel hook 사용 #11

Merged
merged 1 commit into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion component/button/MainButton.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { Button, ButtonProps } from "@chakra-ui/react";
import React from "react";

const MainButton = ({ children, w, h }: ButtonProps) => {
const MainButton = ({ children, w, h, onClick }: ButtonProps) => {
return (
<Button
bgColor={"#000000"}
textColor={"white"}
borderRadius={"12px"}
w={w}
h={h}
onClick={onClick}
>
{children}
</Button>
Expand Down
29 changes: 21 additions & 8 deletions component/form/UserInfoForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ function RadioCard(props: any) {
);
}

const UserInfoForm = () => {
interface UserInfoFormPropsType {
setFunnel: React.Dispatch<React.SetStateAction<string>>;
}

const UserInfoForm = ({ setFunnel }: UserInfoFormPropsType) => {
const params = useParams();

const options = ["남성", "여성"];
Expand Down Expand Up @@ -76,7 +80,7 @@ const UserInfoForm = () => {
기본정보를 입력해주세요
</Heading>
</Box>
<Flex as={"form"} flexDir={"column"} w={"100%"}>
<HStack as={"form"} flexDir={"column"} w={"100%"} spacing={5}>
<FormControl isRequired>
<FormLabel fontSize={"15px"} color={"#5C5C5C"}>
이름
Expand All @@ -98,12 +102,21 @@ const UserInfoForm = () => {
})}
</HStack>
</FormControl>
<ButtonGroup>
<MainButton w={"100%"} h={"52px"}>
다음으로
</MainButton>
</ButtonGroup>
</Flex>
</HStack>
<ButtonGroup
width={"90%"}
pos={"fixed"}
bottom={"30px"}
margin={"0 auto"}
>
<MainButton
w={"100%"}
h={"52px"}
onClick={() => setFunnel("userPhysics")}
>
다음으로
</MainButton>
</ButtonGroup>
</Flex>
</>
);
Expand Down
6 changes: 5 additions & 1 deletion component/form/UserPhysicForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import React from "react";
import MainInput from "../input/MainInput";
import MainButton from "../button/MainButton";

const UserPhysicForm = () => {
interface UserPhysicsFormPropsType {
setFunnel: React.Dispatch<React.SetStateAction<string>>;
}

const UserPhysicForm = ({ setFunnel }: UserPhysicsFormPropsType) => {
return (
<Flex as={"form"} flexDir={"column"}>
<MainInput w={"100%"} />
Expand Down
12 changes: 12 additions & 0 deletions component/progressBar/ProgressBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use client";
import React from "react";

const ProgressBar = () => {
return (
<>
<Progress colorScheme="green" size="sm" value={progress} />
</>
);
};

export default ProgressBar;
3 changes: 1 addition & 2 deletions src/app/globals.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
html,
body {
max-width: 100vw;
overflow-x: hidden;
height: 100%;
}

@media (prefers-color-scheme: dark) {
Expand Down
8 changes: 2 additions & 6 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import { ChakraLayout } from "@/app/ChakraLayout";
import QueryLayout from "./QueryLayout";

const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
Expand All @@ -17,8 +13,8 @@ export default function RootLayout({
children: React.ReactNode;
}) {
return (
<html lang="en">
<body className={inter.className}>
<html lang="en" suppressHydrationWarning>
<body suppressHydrationWarning={true}>
<QueryLayout>
<ChakraLayout>{children}</ChakraLayout>
</QueryLayout>
Expand Down
23 changes: 17 additions & 6 deletions src/app/signup/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
"use client";
import React from "react";
import React, { useState } from "react";
import UserInfoForm from "../../../component/form/UserInfoForm";
import { Box } from "@chakra-ui/react";
import { Box, Progress, extendTheme } from "@chakra-ui/react";
import { useFunnel } from "../../../utils/hooks/useFunnel";
import UserPhysicForm from "../../../component/form/UserPhysicForm";

const page = () => {
const Page = () => {
const [progress, setProgress] = useState<number>(30);
const { funnel, setFunnel } = useFunnel();
return (
<>
<Box width={"100%"}>
<UserInfoForm />
<Progress
bgColor={"#D9D9D9"}
// colorScheme="black"
size="sm"
value={progress}
/>
<Box width={"100%"} h={"100%"}>
{funnel === "userInfo" && <UserInfoForm setFunnel={setFunnel} />}
{funnel === "userPhysics" && <UserPhysicForm setFunnel={setFunnel} />}
</Box>
</>
);
};

export default page;
export default Page;
2 changes: 1 addition & 1 deletion utils/hooks/useFunnel.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from "react";

export const useFunnel = () => {
const [funnel, setFunnel] = useState();
const [funnel, setFunnel] = useState("userInfo");

return { funnel, setFunnel };
};