Home.tsx 1.28 KB
Newer Older
Lee SeoYeon's avatar
Lee SeoYeon committed
1
2
import React, { FormEvent } from "react";
import { useAuth } from "../auth/auth.context";
3
import SurveyImg from "../icons/surveyimg.png";
4

Lee SeoYeon's avatar
Lee SeoYeon committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
export const Home = () => {
  const { user } = useAuth();

  function clickHome(e: React.MouseEvent<HTMLButtonElement>) {
    e.preventDefault();
    if (!user.isLoggedIn) {
      console.log("버튼");
      location.href = "/login";
    } else {
      location.href = "/profile";
    }
  }

  return (
    <div className="flex flex-col place-items-center">
      <div className="justify-end text-center text-3xl text-black h-16 mt-12">
        가장 쉽게 설문지를 만드세요!
      </div>
      <div className="flex flex-col place-items-center container">
24
        <div className="flex h-14 w-28 items-center border-2 font-bold text-black bg-gray-200 hover:bg-themeColor rounded-lg ">
Lee SeoYeon's avatar
Lee SeoYeon committed
25
26
          <button
            type="button"
27
            className="text-center text-xl h-full w-28 font-bold hover:text-white place-items-center"
Lee SeoYeon's avatar
Lee SeoYeon committed
28
29
            onClick={clickHome}
          >
Jiwon Yoon's avatar
Jiwon Yoon committed
30
            +
Lee SeoYeon's avatar
Lee SeoYeon committed
31
32
          </button>
        </div>
Lee SeoYeon's avatar
Lee SeoYeon committed
33
        <p className="text-center text-xl text-black mt-3">Create now!</p>
Lee SeoYeon's avatar
Lee SeoYeon committed
34
35
      </div>
      <div className="flex justify-center">
36
        <img src={SurveyImg} className="object-scale-down justify-center" />
37
38
      </div>
    </div>
Lee SeoYeon's avatar
Lee SeoYeon committed
39
40
  );
};