AQuestion.tsx 842 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
import React from "react";
import { IQuestionData, IAnswer } from "../types";
import { getAnswerElementByType } from "../helpers";

type Props = {
  question: IQuestionData;
  answer: IAnswer;
};

export const AQuestion = ({ question, answer }: Props) => {
  return (
Jiwon Yoon's avatar
Jiwon Yoon committed
12
13
    <div className="w-4/5 border-2 border-themeColor m-3 p-4 rounded-lg">
      <div className="md:flex w-full flex-row-reverse my-1 justify-between">
14
        {question.isRequired ? (
Jiwon Yoon's avatar
Jiwon Yoon committed
15
          <div className="text-xs text-red-600 justify-end">* 필수질문</div>
16
17
18
        ) : (
          <></>
        )}
Jiwon Yoon's avatar
Jiwon Yoon committed
19
20
21
22
        <div className="md:text-xl text-base font-bold">{question.title}</div>
      </div>
      <div className="md:text-base text-sm w-11/12 text-slate-500">
        {question.comment}
23
24
25
26
27
      </div>
      {getAnswerElementByType(question, answer)}
    </div>
  );
};