forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[changed] Modal doesn't require ModalTrigger
- Loading branch information
Showing
10 changed files
with
356 additions
and
183 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ | |
"ModalTrigger", | ||
"OverlayTrigger", | ||
"OverlayMixin", | ||
"Overlay", | ||
"PageHeader", | ||
"PageItem", | ||
"Pager", | ||
|
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,61 @@ | ||
const MyModal = React.createClass({ | ||
const Example = React.createClass({ | ||
|
||
getInitialState(){ | ||
return { showModal: false }; | ||
}, | ||
|
||
render() { | ||
let closeModal = e => this.setState({ showModal: false }); | ||
|
||
let popover = <Popover title='popover'>very popover. such engagement</Popover>; | ||
let tooltip = <Tooltip>wow.</Tooltip>; | ||
|
||
return ( | ||
<Modal {...this.props} title='Modal heading' animation={false}> | ||
<div className='modal-body'> | ||
<h4>Text in a modal</h4> | ||
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula.</p> | ||
|
||
<h4>Popover in a modal</h4> | ||
<p>TODO</p> | ||
|
||
<h4>Tooltips in a modal</h4> | ||
<p>TODO</p> | ||
|
||
<hr /> | ||
|
||
<h4>Overflowing text to show scroll behavior</h4> | ||
<p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> | ||
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> | ||
<p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> | ||
<p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> | ||
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> | ||
<p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> | ||
<p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> | ||
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> | ||
<p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> | ||
</div> | ||
<div className='modal-footer'> | ||
<Button onClick={this.props.onRequestHide}>Close</Button> | ||
</div> | ||
</Modal> | ||
<div> | ||
<p>Click to get the full Modal experience!</p> | ||
|
||
<Button | ||
bsStyle='primary' | ||
bsSize='large' | ||
onClick={e => this.setState({ showModal: true })} | ||
> | ||
Launch demo modal | ||
</Button> | ||
|
||
<Modal show={this.state.showModal} onHide={closeModal}> | ||
<Modal.Header closeButton> | ||
<Modal.Title>Modal heading</Modal.Title> | ||
</Modal.Header> | ||
<Modal.Body> | ||
<h4>Text in a modal</h4> | ||
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula.</p> | ||
|
||
<h4>Popover in a modal</h4> | ||
<p>there is a <OverlayTrigger overlay={popover}><a href='#'>popover</a></OverlayTrigger> here</p> | ||
|
||
<h4>Tooltips in a modal</h4> | ||
<p>there is a <OverlayTrigger overlay={tooltip}><a href='#'>tooltip</a></OverlayTrigger> here</p> | ||
|
||
<hr /> | ||
|
||
<h4>Overflowing text to show scroll behavior</h4> | ||
<p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> | ||
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> | ||
<p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> | ||
<p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> | ||
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> | ||
<p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> | ||
<p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> | ||
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> | ||
<p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> | ||
</Modal.Body> | ||
<Modal.Footer> | ||
<Button onClick={closeModal}>Close</Button> | ||
</Modal.Footer> | ||
</Modal> | ||
</div> | ||
); | ||
} | ||
}); | ||
|
||
const overlayTriggerInstance = ( | ||
<ModalTrigger modal={<MyModal />}> | ||
<Button bsStyle='primary' bsSize='large'>Launch demo modal</Button> | ||
</ModalTrigger> | ||
); | ||
|
||
React.render(overlayTriggerInstance, mountNode); | ||
React.render(<Example/>, mountNode); |
This file contains 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
Oops, something went wrong.