New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-custom-modal

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-custom-modal

This component supports showing any custom modal dialog.

latest
Source
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

react-custom-modal

This component supports showing any custom modal dialog.

It is possible to display by method call.

Example

NPM

Install

npm install react-custom-modal

Usage

import React, {Component} from 'react'
import 'react-custom-modal/dist/index.css'
import Modal from 'react-custom-modal'

export default class App extends Component {
  constructor(props) {
    super(props)
    this.dialog = React.createRef()
    this.showDialog = this.showDialog.bind(this)
  }

  showDialog() {
    this.dialog.current.show({
      component: <CustomDialog/>,
      animation: 'slideUp'
    })
  }

  render() {
    return (
      <div>
        <button className='btn'
                onClick={this.showDialog}>
          Show Dialog
        </button>
        <Modal className='Custom'
               dialogClass='CustomDialog'
               ref={this.dialog}/>
      </div>
    )
  }
}

class CustomDialog extends Component {
  render() {
    const {close} = this.props
    return (
      <div>
        <div className='modal-header'>
          <span className='title'>Modal title</span>
          <button className='close-btn' onClick={close}>
            <span>&times;</span>
          </button>
        </div>
        <div className='modal-body'>
          <p>Modal body text goes here.</p>
        </div>
        <div className='modal-footer'>
          <button className='btn' onClick={close}>Cancel</button>
          <button className='btn' onClick={close}>Save</button>
        </div>
      </div>
    )
  }
}

License

MIT © sk39

Keywords

react

FAQs

Package last updated on 29 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts