Created
August 28, 2014 19:12
-
-
Save naush/9d6ba6a9e46c1a7c19a9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<script> | |
var Button = React.createClass({ | |
propTypes: { | |
title: React.PropTypes.string | |
}, | |
render: function() { | |
return React.DOM.button({}, this.props.title); | |
} | |
}); | |
var Checkbox = React.createClass({ | |
render: function() { | |
return React.DOM.input({type: 'checkbox'}); | |
} | |
}); | |
var TableHead = React.createClass({ | |
propTypes: { | |
text: React.PropTypes.string | |
}, | |
render: function() { | |
return React.DOM.th({}, this.props.text); | |
} | |
}); | |
var TableRow = React.createClass({ | |
render: function() { | |
return React.DOM.tr({}, this.props.cells); | |
} | |
}); | |
var TableCellCheckbox = React.createClass({ | |
render: function() { | |
return React.DOM.td({}, Checkbox()); | |
} | |
}); | |
var TableCell = React.createClass({ | |
propTypes: { | |
text: React.PropTypes.string | |
}, | |
render: function() { | |
return React.DOM.td({}, this.props.text); | |
} | |
}); | |
var Table = React.createClass({ | |
render: function() { | |
return React.DOM.table({}, this.props.rows); | |
} | |
}); | |
var NewTable = React.createClass({ | |
render: function() { | |
return Table({rows: [ | |
TableRow({ | |
cells: [ | |
TableHead({text: 'head 1'}), | |
TableHead({text: 'head 2'}), | |
TableHead({text: 'head 3'}) | |
] | |
}), | |
TableRow({ | |
cells: [ | |
TableCellCheckbox(), | |
TableCell({text: 'cell 2'}), | |
TableCell({text: 'cell 3'}) | |
] | |
}), | |
]}); | |
} | |
}); | |
React.renderComponent( | |
React.DOM.div({}, [ | |
NewTable(), | |
Button({title: 'Enter'}) | |
]), | |
document.getElementById('content')); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment