1.0.1 • Published 5 years ago

flw-modal v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

flw-modal

Just a simple React.js component for modals.

NPM JavaScript Style Guide

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

1.0.1

5 years ago

1.0.0

5 years ago