- 댓글 컴포넌트 : 댓글이 표시되는 부분
- 댓글폼 컴포넌트 : 댓글을 입력하는 폼 부분
- 댓글/답글 섹션 컴포넌트 : 댓글과 답글 모달에 해당하는 부분
import React, { FC, useState, ChangeEvent, FormEvent } from "react";
interface CommentFormProps {
handleComment: (comment: string) => void;
handleClose: () => void;
}
const CommentForm: FC<CommentFormProps> = ({ handleComment, handleClose }) => {
const [comment, setComment] = useState("");
const handleSubmit = (e: FormEvent<HTMLFormElement>) => {
e.preventDefault();
handleComment(comment);
setComment("");
handleClose();
};
const handleInputChange = (e: ChangeEvent<HTMLTextAreaElement>) => {
setComment(e.target.value);
};
return (
<div className="flex w-full h-25 flex-col space-x-4 items-start rounded-lg border text-gray-500 ">
<div className="flex ml-4 mt-2">
<div className="w-7 h-7 bg-white border border-gray-300 rounded-full"></div>
<div className="ml-2 text-gray-500 mb-1 pt-[3px]">Username</div>
</div>
<div className="flex w-full mb-2">
<form onSubmit={handleSubmit} className="w-full flex pr-8">
<textarea
className="w-11/12 h-10 p-2 resize-none border-none rounded text-black"
value={comment}
onChange={handleInputChange}
placeholder="댓글을 입력해주세요."
/>
<div className="flex m-auto ml-2 justify-end w-40 pt-1">
<button
type="submit"
className="w-4/5 h-7 text-sm bg-blue-500 text-white rounded-md float-right"
>
업로드
</button>
</div>
</form>
</div>
</div>
);
};
export default CommentForm;
- 기록하기
- 공부하기
- 협업 중요시 생각하기
- 깃에 대한 무지함
- 아직은 필요한 의존도
- 깃 공부하고 정리하기
- 맡은 부분 확실하게 하기
본 후기는 유데미-스나이퍼팩토리 10주 완성 프로젝트캠프 학습 일지 후기로 작성 되었습니다.
#프로젝트캠프 #프로젝트캠프후기 #유데미 #스나이퍼팩토리 #웅진씽크빅 #인사이드아웃 #IT개발캠프 #개발자부트캠프 #리액트 #react #부트캠프 #리액트캠프