Skip to content

Commit a778433

Browse files
Comment box added
1 parent ce4c03b commit a778433

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/components/blog/Comment.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, {Component} from 'react';
22
import { Link } from 'react-router-dom';
33
import Loader from '../Loader';
4+
import CreateComment from './CreateComment';
45

56

67
class Comments extends Component {
@@ -38,7 +39,10 @@ class Comments extends Component {
3839
}
3940

4041
if (this.state.comments.length <= 0 ){
41-
return <p style={{textAlign:"center"}}><small>Be first one to comment.</small></p>
42+
return <div>
43+
<CreateComment />
44+
<p style={{textAlign:"center"}}><small>Be first one to comment.</small></p>
45+
</div>
4246
}
4347

4448
const comments = this.state.comments.map(comment => {
@@ -57,6 +61,7 @@ class Comments extends Component {
5761

5862
return (
5963
<div>
64+
<CreateComment />
6065
{comments}
6166
</div>
6267
)

src/components/blog/CreateComment.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React, {Component} from 'react';
2+
3+
class CreateComment extends Component {
4+
render () {
5+
return (
6+
<div>
7+
<form action="">
8+
<div className="form-group">
9+
10+
<textarea name="comemnt" id="comment" cols="" rows="3" className="form-control" placeholder="comments here"></textarea>
11+
</div>
12+
<div>
13+
<input type="submit" value="submit" className="btn btn-primary btn-sm"/>
14+
</div>
15+
</form>
16+
</div>
17+
);
18+
}
19+
}
20+
21+
export default CreateComment;

0 commit comments

Comments
 (0)