File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 1
1
import React , { Component } from 'react' ;
2
2
import { Link } from 'react-router-dom' ;
3
3
import Loader from '../Loader' ;
4
+ import CreateComment from './CreateComment' ;
4
5
5
6
6
7
class Comments extends Component {
@@ -38,7 +39,10 @@ class Comments extends Component {
38
39
}
39
40
40
41
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 >
42
46
}
43
47
44
48
const comments = this . state . comments . map ( comment => {
@@ -57,6 +61,7 @@ class Comments extends Component {
57
61
58
62
return (
59
63
< div >
64
+ < CreateComment />
60
65
{ comments }
61
66
</ div >
62
67
)
Original file line number Diff line number Diff line change
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 ;
You can’t perform that action at this time.
0 commit comments