flw-modal
v1.0.1
Published
Just a simple React.js component for modals.
Downloads
4
Readme
flw-modal
Just a simple React.js component for modals.
Install
npm install --save flw-modal
Usage
import React, { Component } from 'react'
import { Modal } from 'flw-modal'
export default class App extends Component {
state = {
showModal: false
}
toggleModal = () => {
this.setState(prevState => ({
showModal: !prevState.showModal
}))
}
render () {
const { showModal } = this.state;
return (
<div>
<div className="centerBtnDiv">
<h1>Modal</h1>
<button
onClick={ this.toggleModal }
className="primary-btn">Show modal</button>
</div>
<Modal
title="Title of the modal"
toggleModal={ this.toggleModal }
showModal={ showModal } >
<h3 style={{ margin: 0 }}>Hello world!</h3>
<p>Content</p>
<div className="modalBtnDiv">
<button
onClick={ this.toggleModal }
className="primary-btn">OK</button>
</div>
</Modal>
</div>
)
}
}
License
MIT © JulienRioux