1.0.4 • Published 3 years ago

stunning-awesome-modal v1.0.4

Weekly downloads
33
License
MIT
Repository
github
Last release
3 years ago

Deprecated

This repository is deprecated. But I created a new modal package which uses react hooks. It's easier and more intuitive. Prease look at the new repository.

e.g: https://github.com/shibe97/react-hooks-use-modal

react-awesome-modal

Build Status

This is a Customizable Modal.

http://shibe97.github.io/react-awesome-modal/

demo

Usage

import React, { Component } from 'react';
import Modal from 'react-awesome-modal';

export default class Examples extends 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()} />
                <Modal visible={this.state.visible} width="400" height="300" effect="fadeInUp" onClickAway={() => this.closeModal()}>
                    <div>
                        <h1>Title</h1>
                        <p>Some Contents</p>
                        <a href="javascript:void(0);" onClick={() => this.closeModal()}>Close</a>
                    </div>
                </Modal>
            </section>
        );
    }
}

Props

AttributeRequiredTypedescriptionexample
visiblerequiredBooleanto show or hide the dialogfalse
effectoptionStringto set how to pop-upfadeInUp, fadeInDown, etc...
widthoptionStringto set modal width (px or %)500, 500px, 80%
heightoptionStringto set modal height (px or %)400, 400px, 50%
onClickAwayoptionFunctionto set actions when the user click the mask-

Effect

  • fadeInDown default
  • fadeInUp
  • fadeInLeft
  • fadeInRight

How To Develop

Setup

$ npm install

Build

$ npm run build

Watch and auto build

$ npm run watch

Test

$ npm test

Docs

$ npm run docs

License

MIT

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago