Skip to content

Instantly share code, notes, and snippets.

@krescruz
Created December 20, 2017 17:48
Show Gist options
  • Save krescruz/472b0f491b2dc02773e0d5353eb59a47 to your computer and use it in GitHub Desktop.
Save krescruz/472b0f491b2dc02773e0d5353eb59a47 to your computer and use it in GitHub Desktop.
React modal with bootstrap component
import React, { Component } from 'react'
import PropTypes from 'prop-types'
class BsModalSimple extends Component {
onCloseModal() {}
render() {
const { show, body, title } = this.props
return (
<div id="mdl-info" className={ 'modal fade ' + (show ? ' in show' : 'hidden')} tabIndex="-1" role="dialog">
<div className="modal-dialog">
<div className="modal-content">
<div className="modal-header">
<h4 className="modal-title"><span className="icon-icon25"></span>{ title }</h4>
</div>
<div className="modal-body">{ body }</div>
<div className="modal-footer">
<button type="button" className="btn btn-default" id="mdl-info" data-dismiss="modal" onClick={(e) => this.onCloseModal(this)}>OK</button>
</div>
</div>
</div>
</div>
)
}
}
BsModalSimple.propTypes = {
show: PropTypes.bool.isRequired
}
export default BsModalSimple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment