Created
May 27, 2015 16:03
-
-
Save cosminnicula/4fb7bcbf43d0e9f0271a 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
| <!DOCTYPE html> | |
| <html xmlns="http://www.w3.org/1999/xhtml"> | |
| <head> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"/> | |
| <meta charset="utf-8"/> | |
| <meta http-equiv="X-UA-Compatible" content="IE=Edge"> | |
| <title>Modal example</title> | |
| <link href="../../../../../node_modules/bootstrap/dist/css/bootstrap.css" rel="stylesheet"/> | |
| <link href="../../../../../node_modules/bootstrap/dist/css/bootstrap-theme.css" rel="stylesheet"/> | |
| </head> | |
| <body> | |
| <div id="example"></div> | |
| <script src="vendors.js"></script> | |
| <script src="bundle.js"></script> | |
| </body> | |
| </html> |
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
| 'use strict'; | |
| import React from 'react'; | |
| import Modal from './modal.jsx'; | |
| React.render( | |
| <Modal /> | |
| , document.getElementById('example') | |
| ); |
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
| 'use strict'; | |
| import React from 'react'; | |
| import {Modal, Button, ModalTrigger} from 'react-bootstrap'; | |
| import Draggable from 'react-draggable'; | |
| const MyModal = React.createClass({ | |
| getDefaultProps: function () { | |
| return { | |
| backdrop: false | |
| } | |
| }, | |
| render: function () { | |
| return ( | |
| <Draggable handle=".modal-header"> | |
| <Modal {...this.props} bsSize='small' title='Modal heading' animation={false}> | |
| <div className='modal-body'> | |
| <span>This is a test!</span> | |
| </div> | |
| <div className='modal-footer'> | |
| <Button>Close</Button> | |
| </div> | |
| </Modal> | |
| </Draggable> | |
| ) | |
| } | |
| }); | |
| const MyModalTrigger = React.createClass({ | |
| render() { | |
| return ( | |
| <div> | |
| <ModalTrigger ref="modalTrigger" modal={<MyModal />}><span></span></ModalTrigger> | |
| <Button bsStyle='primary' bsSize='large' onClick={this.handleToggle}>Launch demo modal</Button> | |
| </div> | |
| ) | |
| }, | |
| handleToggle() { | |
| this.refs.modalTrigger.toggle(); | |
| } | |
| }); | |
| module.exports = MyModalTrigger; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment