@@ -8,6 +8,7 @@ class TreeNode extends React.Component {
88 expanded : React . PropTypes . bool . isRequired ,
99 optimisticToggle : React . PropTypes . bool . isRequired ,
1010 title : React . PropTypes . string . isRequired ,
11+ treeId : React . PropTypes . string . isRequired ,
1112 value : React . PropTypes . string . isRequired ,
1213 onCheck : React . PropTypes . func . isRequired ,
1314 onExpand : React . PropTypes . func . isRequired ,
@@ -100,21 +101,25 @@ class TreeNode extends React.Component {
100101 }
101102
102103 render ( ) {
104+ const { checked, treeId, title, value } = this . props ;
105+ const inputId = `${ treeId } -${ value } ` ;
106+
103107 return (
104108 < li className = "rct-node" >
105109 < span className = "rct-text" >
106- < span className = "rct-collapse" title = "Toggle" onClick = { this . onExpand } >
110+ < button className = "rct-collapse" title = "Toggle" onClick = { this . onExpand } >
107111 { this . renderCollapseIcon ( ) }
108- </ span >
109- < label onClick = { this . onCheck } >
112+ </ button >
113+ < label htmlFor = { inputId } >
114+ < input checked = { checked === 1 } id = { inputId } type = "checkbox" onChange = { this . onCheck } />
110115 < span className = "rct-checkbox" >
111116 { this . renderCheckboxIcon ( ) }
112117 </ span >
113118 < span className = "rct-icon" >
114119 { this . renderNodeIcon ( ) }
115120 </ span >
116121 < span className = "rct-title" >
117- { this . props . title }
122+ { title }
118123 </ span >
119124 </ label >
120125 </ span >
0 commit comments