()
| 29 | } |
| 30 | |
| 31 | render() { |
| 32 | const content = <div> |
| 33 | <h4>this is content</h4> |
| 34 | <p>This is a modal window. You can do the following things with it:</p> |
| 35 | <ul> |
| 36 | <li>Read: modal windows will probably tell you something important so don't forget to read what they say.</li> |
| 37 | <li>Look: a modal window enjoys a certain kind of attention; just look at it and appreciate its presence.</li> |
| 38 | <li>Close: click on the button to close the modal.</li> |
| 39 | <li> |
| 40 | <a href="http://braavos.me" target="_blank">blog</a> |
| 41 | </li> |
| 42 | </ul> |
| 43 | </div> |
| 44 | return ( |
| 45 | <div> |
| 46 | <h3>Modal</h3> |
| 47 | <pre> |
| 48 | <code>onConfirm, onCancel, onClose need a return value(Boolean) to decide whether to close modal</code> |
| 49 | </pre> |
| 50 | <ol> |
| 51 | <li> |
| 52 | <h4>Default modal</h4> |
| 53 | <button onClick={this.openModal.bind(this, 'modal0')}>click</button> |
| 54 | <Modal ref="modal0" title={<h4>Confirm deleted</h4>}> |
| 55 | {content} |
| 56 | </Modal> |
| 57 | <pre> |
| 58 | <code> |
| 59 | {` |
| 60 | <a href="#" onClick={this.refs.modal.open}>click</a> |
| 61 | <Modal title={<h4>Confirm deleted</h4>} ref="modal"> |
| 62 | ... |
| 63 | </Modal> |
| 64 | `} |
| 65 | </code> |
| 66 | </pre> |
| 67 | </li> |
| 68 | <li> |
| 69 | <h4>Modal with confirm, cancel action</h4> |
| 70 | <button onClick={this.openModal.bind(this, 'modal1')}>click</button> |
| 71 | <Modal ref="modal1" onConfirm={this.handleConfirm.bind(this)} |
| 72 | onCancel={this.handleCancel.bind(this)}> |
| 73 | {content} |
| 74 | </Modal> |
| 75 | <pre> |
| 76 | <code> |
| 77 | {` |
| 78 | <a href="#" onClick={this.refs.modal.open}>click</a> |
| 79 | <Modal ref="modal" onConfirm={handleConfirm} onCancel={handleCancel}> |
| 80 | {content} |
| 81 | </Modal> |
| 82 | `} |
| 83 | </code> |
| 84 | </pre> |
| 85 | </li> |
| 86 | <li> |
| 87 | <h4>Modal with only confirm action</h4> |
| 88 | <button onClick={this.openModal.bind(this, 'modal2')}>click</button> |
nothing calls this directly
no outgoing calls
no test coverage detected