UNPKG

zotero-web-library

Version:

Web library from zotero.org

38 lines (33 loc) 1.19 kB
'use strict'; var log = require('libzotero/lib/Log').Logger('zotero-web-library:BootstrapModalWrapper'); var React = require('react'); var BootstrapModalWrapper = React.createClass({ displayName: 'BootstrapModalWrapper', // The following two methods are the only places we need to // integrate Bootstrap or jQuery with the components lifecycle methods. componentDidMount: function componentDidMount() { // When the component is added, turn it into a modal log.debug('BootstrapModalWrapper componentDidMount', 3); J(this.refs.root).modal({ backdrop: 'static', keyboard: false, show: false }); }, componentWillUnmount: function componentWillUnmount() { log.debug('BootstrapModalWrapper componentWillUnmount', 3); J(this.refs.root).off('hidden', this.handleHidden); }, close: function close() { log.debug('BootstrapModalWrapper close', 3); J(this.refs.root).modal('hide'); }, open: function open() { log.debug('BootstrapModalWrapper open', 3); J(this.refs.root).modal('show'); }, render: function render() { return React.createElement( 'div', { className: 'modal', ref: 'root' }, this.props.children ); } }); module.exports = BootstrapModalWrapper;