QEssay.tsx 2.17 KB
Newer Older
1
import React, { useState } from "react";
Jiwon Yoon's avatar
Jiwon Yoon committed
2
import { EssayType } from "./CreateSurveyFormPage";
Jiwon Yoon's avatar
Jiwon Yoon committed
3
import { useQuestion } from "./question.context";
Jiwon Yoon's avatar
Jiwon Yoon committed
4
import { Edit } from "./Edit";
5
6
7
8
9

type Props = {
  element: EssayType;
};

Jiwon Yoon's avatar
Jiwon Yoon committed
10
11
12
export const QEssay = ({ element }: Props) => {
  const { questionListChange } = useQuestion();

13
14
  return (
    <div className="flex flex-col container w-4/5 h-auto border-2 border-themeColor items-center m-3 py-2">
Jiwon Yoon's avatar
Jiwon Yoon committed
15
      <div className="flex h-16 w-full place-content-between items-center">
Jiwon Yoon's avatar
Jiwon Yoon committed
16
17
        <input
          type="text"
Jiwon Yoon's avatar
Jiwon Yoon committed
18
          name="title"
Jiwon Yoon's avatar
Jiwon Yoon committed
19
          id={element._id}
Jiwon Yoon's avatar
Jiwon Yoon committed
20
21
          className="text-xl font-bold ml-6 border-b-2 w-1/2"
          placeholder={element.title}
Jiwon Yoon's avatar
Jiwon Yoon committed
22
          onChange={questionListChange}
Jiwon Yoon's avatar
Jiwon Yoon committed
23
        ></input>
24
25
        <select
          id="Questions"
Jiwon Yoon's avatar
Jiwon Yoon committed
26
          className="w-36 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-themeColor w-full mr-3 p-2.5"
27
28
        >
          <option>질문종류</option>
Jiwon Yoon's avatar
Jiwon Yoon committed
29
          <option value="essay" selected>
30
31
            주관식
          </option>
Jiwon Yoon's avatar
Jiwon Yoon committed
32
33
34
35
36
37
38
          <option value="radio">객관식</option>
          <option value="dropdown">드롭다운(객관식)</option>
          <option value="checkbox">체크박스(객관식)</option>
          <option value="file">파일업로드</option>
          <option value="rating">선형</option>
          <option value="grid">그리드</option>
          <option value="date">날짜</option>
39
40
        </select>
      </div>
Jiwon Yoon's avatar
Jiwon Yoon committed
41
42
43
      <div className="flex w-full justify-center">
        <input
          type="text"
Jiwon Yoon's avatar
Jiwon Yoon committed
44
          name="comment"
Jiwon Yoon's avatar
Jiwon Yoon committed
45
          id={element._id}
Jiwon Yoon's avatar
Jiwon Yoon committed
46
          className="border w-11/12"
47
          placeholder="질문에 대한 설명을 입력해주세요"
Jiwon Yoon's avatar
Jiwon Yoon committed
48
          onChange={questionListChange}
Jiwon Yoon's avatar
Jiwon Yoon committed
49
        ></input>
50
      </div>
Jiwon Yoon's avatar
Jiwon Yoon committed
51
52
      <div id="commentarea" className="flex mt-4 w-full justify-center">
        <input className="border w-11/12 h-16" disabled></input>
53
      </div>
Jiwon Yoon's avatar
Jiwon Yoon committed
54
      <div className="flex w-full justify-end py-2">
55
        <button className="w-1/12">필수</button>
Jiwon Yoon's avatar
Jiwon Yoon committed
56
        <button className="w-1/12">옵션</button>
57
        <button className="w-1/12">삭제</button>
Jiwon Yoon's avatar
Jiwon Yoon committed
58
        <Edit id={element._id} />
59
60
61
62
      </div>
    </div>
  );
};