mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 03:37:56 +01:00
Add new post form
This commit is contained in:
55
app/javascript/components/Board/NewPostForm.tsx
Normal file
55
app/javascript/components/Board/NewPostForm.tsx
Normal file
@@ -0,0 +1,55 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import '../../stylesheets/components/Board/NewPostForm.scss';
|
||||
|
||||
interface Props {
|
||||
title: string;
|
||||
description: string;
|
||||
handleTitleChange(title: string): void;
|
||||
handleDescriptionChange(description: string): void;
|
||||
handleSubmit(e: object): void;
|
||||
}
|
||||
|
||||
const NewPostForm = ({
|
||||
title,
|
||||
description,
|
||||
handleTitleChange,
|
||||
handleDescriptionChange,
|
||||
handleSubmit,
|
||||
}: Props) => (
|
||||
<div className="newPostForm">
|
||||
<form>
|
||||
<div className="form-group">
|
||||
<label htmlFor="postTitle">Title</label>
|
||||
<input
|
||||
type="text"
|
||||
value={title}
|
||||
onChange={e => handleTitleChange(e.target.value)}
|
||||
|
||||
id="postTitle"
|
||||
className="form-control"
|
||||
|
||||
autoFocus
|
||||
/>
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label htmlFor="postDescription">Description (optional)</label>
|
||||
<textarea
|
||||
value={description}
|
||||
onChange={e => handleDescriptionChange(e.target.value)}
|
||||
rows={3}
|
||||
|
||||
className="form-control"
|
||||
id="postDescription"
|
||||
></textarea>
|
||||
</div>
|
||||
<button
|
||||
onClick={e => handleSubmit(e)}
|
||||
className="submitBtn btn btn-dark d-block mx-auto">
|
||||
Submit feedback
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
|
||||
export default NewPostForm;
|
||||
Reference in New Issue
Block a user