New comments can be created

This commit is contained in:
riggraz
2019-09-18 13:40:00 +02:00
parent ecfdc54100
commit 7701c8f5e6
12 changed files with 267 additions and 18 deletions

View File

@@ -0,0 +1,28 @@
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}
/>
<Button onClick={() => handleSubmit(body, parentId)}>Submit</Button>
</div>
);
export default NewComment;