1.0.10 • Published 4 years ago

react-subwindow v1.0.10

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

react-subwindow

A react way to create modals and some useful utility functions

NPM JavaScript Style Guide

Install

npm install --save react-subwindow

Usage

import React from 'react'

import { createSubwindow } from 'react-subwindow'
import 'react-subwindow/dist/index.css'

const App = () => {
  return (
    <div>
      <button
        onClick={() => createSubwindow(
          <div>
            <h1>Saying hello from modal</h1>
          </div>
        )}
      >Open Modal</button>
      <br/>
      <button
        onClick={
          () => {
            onConfirmationPopup("Are you sure", function confirm() {
              window.alert("This will show up if you click on 'Confirm'")
            })
          }
        }
      >
        Do something after confirmation
      </button>
    </div>
  )
}

export default App

API

import { createSubwindow, onConfirmationPopup, getZIndex, releaseZIndex } from 'react-subwindow'

createSubwindow(reactElement)

Example

createSubwindow(
  <div>
    <h1>Saying hello from modal</h1>
  </div>
)

onConfirmationPopup(title, onConfirm)

Example

onConfirmationPopup(
  "Are you sure", 
  function confirm() {
    window.alert("This will show up if you click on 'Confirm'")
  }
)

getZIndex()

Returns number lowest available z index

Use this method to book a z-index value

releaseZIndex()

Release the last z index returned by getZIndex()

License

MIT © Raufoon

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago