Files
astuto/app/javascript/components/Comments/NewComment.tsx

28 lines
561 B
TypeScript
Raw Normal View History

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