Profile.tsx 4.04 KB
Newer Older
Jiwon Yoon's avatar
Jiwon Yoon committed
1
import React, { useState } from "react";
2
import { useNavigate } from "react-router-dom";
Jiwon Yoon's avatar
Jiwon Yoon committed
3
4
import { surveyApi } from "../apis";
import { SurveyType } from "../types";
Yoon, Daeki's avatar
Yoon, Daeki committed
5
6

export const Profile = () => {
7
  const navigate = useNavigate();
Jiwon Yoon's avatar
Jiwon Yoon committed
8
9
10
11
12
13
14
15
16
17
18
19
  const [survey, setSurvey] = useState<SurveyType>({
    user: {},
    title: "",
    comment: "",
    questions: [],
  });
  async function createSurvey() {
    const newSurvey: SurveyType = await surveyApi.createSurvey(survey);
    navigate(`/surveys/edit/${newSurvey._id}`, {
      replace: true,
    });
  }
20

Lee SeoYeon's avatar
Lee SeoYeon committed
21
  return (
Lee SeoYeon's avatar
0708    
Lee SeoYeon committed
22
23
    <div className="flex flex-col items-center">
      <div className="m-5">나의 설문조사</div>
jang dong hyeok's avatar
.    
jang dong hyeok committed
24
      <div className="flex space-x-4 mt-5">
25
26
        <button
          onClick={createSurvey}
Lee SeoYeon's avatar
Lee SeoYeon committed
27
28
29
30
31
          className="flex h-60 w-48 items-center border-2 border-themeColor font-bold bg-gray-200 hover:bg-themeColor rounded-lg "
        >
          <div className="text-center px-6 py-6 font-bold text-gray-500 place-items-center hover:text-white">
            CREATE NEW SURVEY!
          </div>
32
        </button>
Lee SeoYeon's avatar
Lee SeoYeon committed
33
34
35
36
37
38
39
40
41
42
        <div className="w-48 h-60 rounded overflow-hidden border-2">
          <div className="px-6 py-4">
            <p className="text-gray-700 text-base">
              Lorem ipsum dolor sit amet, consectetur adipisicing elit.
            </p>
          </div>
          <div className="flex flex-col py-6">
            <div className="px-2 py-2">
              <label>설문조사 이름</label>
            </div>
jang dong hyeok's avatar
.    
jang dong hyeok committed
43
            <div className="flex justify-end">
Lee SeoYeon's avatar
Lee SeoYeon committed
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
              <select className="py-2 w-14 bg-themeColor rounded text-white">
                <option selected>옵션</option>
                <option>삭제</option>
                <option>이름 바꾸기</option>
              </select>
            </div>
          </div>
        </div>
        <div className="w-48 h-60 rounded overflow-hidden border-2">
          <div className="px-6 py-4">
            <p className="text-gray-700 text-base">
              Lorem ipsum dolor sit amet, consectetur adipisicing elit.
            </p>
          </div>
          <div className="flex flex-col py-6">
            <div className="px-2 py-2">
              <label>설문조사이름</label>
            </div>
jang dong hyeok's avatar
.    
jang dong hyeok committed
62
            <div className="flex justify-end">
Lee SeoYeon's avatar
Lee SeoYeon committed
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
              <select className="py-2 w-14 bg-themeColor rounded text-white">
                <option selected>옵션</option>
                <option>삭제</option>
                <option>이름 바꾸기</option>
              </select>
            </div>
          </div>
        </div>
        <div className="w-48 h-60 rounded overflow-hidden border-2">
          <div className="px-6 py-4">
            <p className="text-gray-700 text-base">
              Lorem ipsum dolor sit amet, consectetur adipisicing elit.
            </p>
          </div>
          <div className="flex flex-col py-6">
            <div className="px-2 py-2">
              <label>설문조사 이름</label>
            </div>
jang dong hyeok's avatar
.    
jang dong hyeok committed
81
            <div className="flex justify-end">
Lee SeoYeon's avatar
Lee SeoYeon committed
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
              <select className="py-2 w-14 bg-themeColor rounded text-white">
                <option selected>옵션</option>
                <option>삭제</option>
                <option>이름 바꾸기</option>
              </select>
            </div>
          </div>
        </div>
        <div className="w-48 h-60 rounded overflow-hidden border-2">
          <div className="px-6 py-4">
            <p className="text-gray-700 text-base">
              Lorem ipsum dolor sit amet, consectetur adipisicing elit.
            </p>
          </div>
          <div className="flex flex-col py-6">
            <div className="px-2 py-2">
              <label>설문조사 이름</label>
            </div>
jang dong hyeok's avatar
.    
jang dong hyeok committed
100
            <div className="flex justify-end">
Lee SeoYeon's avatar
Lee SeoYeon committed
101
102
103
104
105
106
107
108
109
110
111
              <select className="py-2 w-14 bg-themeColor rounded text-white">
                <option selected>옵션</option>
                <option>삭제</option>
                <option>이름 바꾸기</option>
              </select>
            </div>
          </div>
        </div>
      </div>
    </div>
  );
Yoon, Daeki's avatar
Yoon, Daeki committed
112
};