QCheckbox.tsx 1.77 KB
Newer Older
1
import React from "react";
2
import { CheckboxType } from "../types";
Jiwon Yoon's avatar
Jiwon Yoon committed
3
4
import { useQuestion } from "./question.context";
import { Edit } from "./Edit";
5
import { TypeChange } from "./typeDD";
6
7
8
9
10

type Props = {
  element: CheckboxType;
};

Jiwon Yoon's avatar
Jiwon Yoon committed
11
12
13
14
15
16
17
18
19
20
21
22
23
24
export const QCheckbox = ({ element }: Props) => {
  const { questionListChange } = useQuestion();

  return (
    <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">
        <input
          type="text"
          name="title"
          id={element._id}
          className="text-xl font-bold ml-6 border-b-2 w-1/2"
          placeholder={element.title}
          onChange={questionListChange}
        ></input>
25
        <TypeChange tt="checkbox" id={element._id} />
Jiwon Yoon's avatar
Jiwon Yoon committed
26
27
28
29
30
31
32
33
34
35
36
37
      </div>
      <div className="flex w-full justify-center">
        <input
          type="text"
          name="comment"
          id={element._id}
          className="border w-11/12"
          placeholder="질문에 대한 설명을 입력해주세요"
          onChange={questionListChange}
        ></input>
      </div>
      <div id="commentarea" className="flex mt-4">
38
        {element.content.choices.map((e: any) => (
Jiwon Yoon's avatar
Jiwon Yoon committed
39
40
41
42
43
          <div>
            <input type="checkbox" checked={false}></input>
            <input
              type="text"
              className="mx-2 border-b-2"
44
              placeholder={e.text}
Jiwon Yoon's avatar
Jiwon Yoon committed
45
46
47
48
49
50
51
52
53
54
            ></input>
          </div>
        ))}
      </div>
      <div className="flex w-full flex-row justify-end py-2">
        <button className="w-1/12">필수</button>
        <button className="w-1/12">옵션</button>
        <button className="w-1/12">삭제</button>
        <Edit id={element._id} />
      </div>
55
    </div>
Jiwon Yoon's avatar
Jiwon Yoon committed
56
57
  );
};