mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 03:37:56 +01:00
New comments can be created
This commit is contained in:
28
app/javascript/components/Comments/NewComment.tsx
Normal file
28
app/javascript/components/Comments/NewComment.tsx
Normal 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;
|
||||
Reference in New Issue
Block a user