File tree Expand file tree Collapse file tree 4 files changed +40
-5
lines changed Expand file tree Collapse file tree 4 files changed +40
-5
lines changed Original file line number Diff line number Diff line change 8
8
.loaded {
9
9
opacity : 1 ;
10
10
}
11
+ .input-group {
12
+ margin-bottom : 15px ;
13
+ }
11
14
</ style >
12
15
</ head >
13
16
< body >
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ var App = React.createClass({
25
25
To-Do List
26
26
</ h2 >
27
27
< Header itemsStore = { this . firebaseRefs . items } />
28
+ < hr />
28
29
< div className = { "content " + ( this . state . loaded ? 'loaded' : '' ) } >
29
30
< List items = { this . state . items } />
30
31
</ div >
Original file line number Diff line number Diff line change
1
+ var React = require ( 'react' ) ;
2
+
3
+ module . exports = React . createClass ( {
4
+ getInitialState : function ( ) {
5
+ return {
6
+ text : this . props . item . text
7
+ }
8
+ } ,
9
+ render : function ( ) {
10
+ return < div className = "input-group" >
11
+ < span className = "input-group-addon" >
12
+ < input type = "checkbox" />
13
+ </ span >
14
+ < input type = "text"
15
+ className = "form-control"
16
+ value = { this . state . text }
17
+ />
18
+ < span className = "input-group-btn" >
19
+ < button className = "btn btn-default" >
20
+ Delete
21
+ </ button >
22
+ </ span >
23
+ </ div >
24
+ }
25
+ } ) ;
Original file line number Diff line number Diff line change 1
1
var React = require ( 'react' ) ;
2
+ var ListItem = require ( './list-item' ) ;
2
3
3
4
module . exports = React . createClass ( {
4
5
render : function ( ) {
5
- return < ul >
6
+ return < div >
6
7
{ this . renderList ( ) }
7
- </ ul >
8
+ </ div >
8
9
} ,
9
10
renderList : function ( ) {
10
11
if ( this . props . items && Object . keys ( this . props . items ) . length === 0 ) {
@@ -15,10 +16,15 @@ module.exports = React.createClass({
15
16
var children = [ ] ;
16
17
17
18
for ( var key in this . props . items ) {
19
+ var item = this . props . items [ key ] ;
20
+ item . key = key ;
21
+
18
22
children . push (
19
- < li >
20
- { this . props . items [ key ] . text }
21
- </ li >
23
+ < ListItem
24
+ item = { item }
25
+ key = { key }
26
+ >
27
+ </ ListItem >
22
28
)
23
29
}
24
30
You can’t perform that action at this time.
0 commit comments