QRadio.tsx 2.07 KB
Newer Older
1
import React from "react";
Jiwon Yoon's avatar
Jiwon Yoon committed
2
import { RadioType } from "./CreateSurveyFormPage";
Jiwon Yoon's avatar
Jiwon Yoon committed
3
import { useQuestion } from "./question.context";
4
import { TypeChange } from "./typeDD";
5
6
7
8
9

type Props = {
  element: RadioType;
};

Jiwon Yoon's avatar
Jiwon Yoon committed
10
11
12
13
14
15
16
17
18
19
20
21
22
export const QRadio = ({ 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 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>
23
        <TypeChange tt="radio" />
Jiwon Yoon's avatar
Jiwon Yoon committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
      </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 className="flex mt-4">
        {element.content.choices.map((e: string, index: number) => (
          <div>
            <input
              type="radio"
              id={element._id}
              name="choice"
              value={e}
              disabled
            />
            <input
              type="text"
              name={"choice" + `${index}`}
              // key={`${index}`}
              className="mx-2 border-b-2"
              placeholder={e}
              onChange={questionListChange}
            ></input>
            <button></button>
          </div>
        ))}
        {/* <button className="border rounded-full border-green-500 border-4 text-green-500 font-bold px-2">
57
58
        +
      </button> */}
Jiwon Yoon's avatar
Jiwon Yoon committed
59
60
61
62
63
64
      </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>
      </div>
65
    </div>
Jiwon Yoon's avatar
Jiwon Yoon committed
66
67
  );
};