ADate.tsx 656 Bytes
Newer Older
Jiwon Yoon's avatar
Jiwon Yoon committed
1
import React, { useState } from "react";
2
import { IAnswerProps } from "../types";
Yoon, Daeki's avatar
Yoon, Daeki committed
3

4
export const ADate = ({ element, answer: content }: IAnswerProps) => {
Jiwon Yoon's avatar
Jiwon Yoon committed
5
6
7
  const [answer, setAnswer] = useState("");
  const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
    const { value } = event.currentTarget;
8
    content.content = value;
Jiwon Yoon's avatar
Jiwon Yoon committed
9
    setAnswer(value);
10
11
    if (content.content) {
      content.requiredCheck = true;
Jiwon Yoon's avatar
Jiwon Yoon committed
12
    } else {
13
      content.requiredCheck = false;
Jiwon Yoon's avatar
Jiwon Yoon committed
14
    }
15
    console.log(content);
Jiwon Yoon's avatar
Jiwon Yoon committed
16
  };
Lee SeoYeon's avatar
Lee SeoYeon committed
17
  return (
Lee SeoYeon's avatar
Lee SeoYeon committed
18
    <div className="justify-start w-11/12 m-3 py-4">
Jiwon Yoon's avatar
Jiwon Yoon committed
19
      <input type="date" onChange={handleChange}></input>
Lee SeoYeon's avatar
Lee SeoYeon committed
20
21
22
    </div>
  );
};