QCheckbox.tsx 2.2 KB
Newer Older
1
import React from "react";
Jiwon Yoon's avatar
Jiwon Yoon committed
2
import { CheckboxType } from "./CreateSurveyFormPage";
3
4
5

type Props = {
  element: CheckboxType;
Jiwon Yoon's avatar
Jiwon Yoon committed
6
  QuestionListChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
7
8
};

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