2019-09-18 13:40:00 +02:00
|
|
|
import * as React from 'react';
|
|
|
|
|
import { FormEvent } from 'react';
|
|
|
|
|
|
|
|
|
|
import Button from '../shared/Button';
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
body: string;
|
|
|
|
|
parentId: number;
|
|
|
|
|
handleChange(e: FormEvent): void;
|
|
|
|
|
handleSubmit(body: string, parentId: number): void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const NewComment = ({
|
|
|
|
|
body,
|
|
|
|
|
parentId,
|
|
|
|
|
handleChange,
|
|
|
|
|
handleSubmit,
|
|
|
|
|
}: Props) => (
|
|
|
|
|
<div className="newCommentForm">
|
|
|
|
|
<textarea
|
|
|
|
|
value={body}
|
|
|
|
|
onChange={handleChange}
|
2019-09-20 17:56:01 +02:00
|
|
|
placeholder="Leave a comment"
|
2019-09-18 17:00:58 +02:00
|
|
|
className="newCommentBody"
|
2019-09-18 13:40:00 +02:00
|
|
|
/>
|
2019-09-20 17:56:01 +02:00
|
|
|
<Button
|
|
|
|
|
onClick={() => handleSubmit(body, parentId)}
|
|
|
|
|
className="submitCommentButton">
|
|
|
|
|
Submit
|
|
|
|
|
</Button>
|
2019-09-18 13:40:00 +02:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export default NewComment;
|