Skip to content

Instantly share code, notes, and snippets.

@ralfting
Created February 1, 2017 01:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ralfting/c12844c199cf27b9433bcfdcb60e11cd to your computer and use it in GitHub Desktop.
Save ralfting/c12844c199cf27b9433bcfdcb60e11cd to your computer and use it in GitHub Desktop.
class ModalText extends React.Component {
constructor(props) {
super(props)
this.state = {
id: this.props.id,
title: this.props.title,
text: this.props.text,
iconClose: this.props.iconClose,
confirmButton: this.props.confirmButton,
cancelButton: this.props.cancelButton,
link: this.props.link
}
}
render() {
const FooterModal = () => {
return (
<div className="modal-footer">
<button data-dismiss="modal" className="generic-button modal-button -save">{this.state.confirmButton}</button>
</div>
)
}
const HeaderModal = () => {
return (
<div className="modal-header">
<button className="close" type="button" data-dismiss="modal">
<span aria-hidden="true">
<img src={this.state.iconClose} />
</span>
</button>
<h3 className="modal-title">{this.state.title}</h3>
</div>
)
}
return (
<div className="modal fade" id={this.state.id} role="dialog">
<div className="modal-dialog modal-lg" role="document">
<div className="modal-content">
<HeaderModal />
<div className="modal-body">
<p className="confirm-text">
{this.state.text}
</p>
</div>
<FooterModal />
</div>
</div>
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment