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 homeImg from "../icons/homeImg.png";
4

Lee SeoYeon's avatar
Lee SeoYeon committed
5
6
7
8
9
10
11
12
13
export const Home = () => {
  const { user } = useAuth();

  function clickHome(e: React.MouseEvent<HTMLButtonElement>) {
    e.preventDefault();
    if (!user.isLoggedIn) {
      console.log("버튼");
      location.href = "/login";
    } else {
14
      location.href = "/surveys/profile";
Lee SeoYeon's avatar
Lee SeoYeon committed
15
16
17
18
19
    }
  }

  return (
    <div className="flex flex-col place-items-center">
jang dong hyeok's avatar
.    
jang dong hyeok committed
20
      <div className="justify-end text-center text-2xl md:text-3xl text-black h-16 mt-12">
Lee SeoYeon's avatar
Lee SeoYeon committed
21
22
23
        가장 쉽게 설문지를 만드세요!
      </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>
33
        <p className="text-center text-xl text-black my-3">Create now!</p>
Lee SeoYeon's avatar
Lee SeoYeon committed
34
      </div>
35
36
      <div className="flex mt-5 md:px-48 bg-themeColor">
        <img src={homeImg} className="m-3" />
37
38
      </div>
    </div>
Lee SeoYeon's avatar
Lee SeoYeon committed
39
40
  );
};