NewThing.js 728 B

1234567891011121314151617181920212223242526
  1. var React = require('react'),
  2. ReactDOM = require('react-dom'),
  3. BootstrapModal = require('./BootstrapModal.js');
  4. var NewThing = React.createClass({
  5. handleCancel: function() {
  6. if (confirm('Are you sure you want to cancel?')) {
  7. this.refs.modal.close();
  8. }
  9. },
  10. render: function () {
  11. return (
  12. <BootstrapModal ref="modal" confirm="OK" cancel="Cancel" onCancel={this.handleCancel} onConfirm={this.closeModal} title="New Thing">
  13. <textarea className="form-control" id="inputContent" rows="5" autofocus />
  14. </BootstrapModal>
  15. );
  16. },
  17. openModal: function() {
  18. this.refs.modal.open();
  19. },
  20. closeModal: function() {
  21. this.refs.modal.close();
  22. }
  23. });
  24. module.exports = NewThing;