This is a Customizable Modal.
http://shibe97.github.io/react-awesome-modal/
import React from 'react';
import Modal from 'react-awesome-modal';
export default class Examples extends React.Component {
constructor(props) {
super(props);
this.state = {
visible : false
}
}
openModal() {
this.setState({
visible : true
});
}
closeModal() {
this.setState({
visible : false
});
}
render() {
return (
<section>
<h1>React-Modal Examples</h1>
<input type="button" value="Open" onClick={this.openModal.bind(this)} />
<Modal visible={this.state.visible} width="400" height="300" effect="fadeInUp">
<div>
<h1>Title</h1>
<p>Some Contents</p>
<a href="javascript:void(0);" onClick={this.closeModal.bind(this)}>Close</a>
</div>
</Modal>
</section>
);
}
}
- visible
- Boolean / required
- to show or hide the dialog
- effect
- String / option
- to set how to pop-up
- e.g. fadeInUp
- width
- Number / option
- to set modal width (px)
- e.g. 500
- height
- Number / option
- to set modal height (px)
- e.g. 400
- fadeInDown [default]
- fadeInUp
- fadeInLeft
- fadeInRight
$ npm install
$ npm run build
$ npm run watch
$ npm test
$ gulp webpack
$ open examples/index.html
MIT