-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
261 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const PostCreateForm = (props) => { | ||
const handleChangeTitle = (e) => { | ||
e.preventDefault(); | ||
props.onChangeTitle(e.target.value); | ||
}; | ||
|
||
const handleChangeBody = (e) => { | ||
e.preventDefault(); | ||
props.onChangeBody(e.target.value); | ||
}; | ||
|
||
return ( | ||
<div className="PostCreateForm"> | ||
<form> | ||
<div className="form-group"> | ||
<label htmlFor="titleInput">Title:</label> | ||
<input | ||
id="titleInput" | ||
name="titleInput" | ||
onChange={handleChangeTitle} | ||
className="form-control" | ||
placeholder="Title" | ||
value={props.title} | ||
required | ||
/> | ||
<label htmlFor="bodyInput">Post Body:</label> | ||
<textarea | ||
id="commentBox" | ||
name="commentBox" | ||
onChange={handleChangeBody} | ||
className="form-control" | ||
type="textarea" | ||
placeholder="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." | ||
value={props.body} | ||
required | ||
></textarea> | ||
</div> | ||
</form> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PostCreateForm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const PostFormButtons = (props) => { | ||
const handleClickCancel = (e) => { | ||
e.preventDefault(); | ||
props.onClickCancel(); | ||
}; | ||
|
||
const handleClickSave = (e) => { | ||
e.preventDefault(); | ||
props.onClickSave(); | ||
}; | ||
|
||
const handleClickSaveAndPublish = (e) => { | ||
e.preventDefault(); | ||
props.onClickSaveAndPublish(); | ||
}; | ||
|
||
return ( | ||
<div className="PostFormButtons"> | ||
<button className="btn btn-danger" onClick={handleClickCancel}> | ||
Cancel | ||
</button> | ||
<br /> | ||
<button className="btn btn-primary" onClick={handleClickSave}> | ||
Save Post (Unpublished) | ||
</button> | ||
<br /> | ||
<button className="btn btn-primary" onClick={handleClickSaveAndPublish}> | ||
Save and Publish Post | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PostFormButtons; |
Oops, something went wrong.