# react-subwindow

> A react way to create modals and some useful utility functions

Latest version **1.0.10** (published 2020-10-18) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install react-subwindow
pnpm add react-subwindow
yarn add react-subwindow
bun add react-subwindow
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.10 |
| Published | 2020-10-18 |
| First published | 2020-10-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 5.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Raufoon |
| Maintainers | raufoon |

## Links

- npm: https://www.npmjs.com/package/react-subwindow
- Repository: https://github.com/Raufoon/react-subwindow
- Homepage: https://github.com/Raufoon/react-subwindow#readme
- Issues: https://github.com/Raufoon/react-subwindow/issues
- npm.io page: https://npm.io/package/react-subwindow

## Recent versions

- 1.0.10 (latest) — 2020-10-18
- 1.0.9 — 2020-10-18
- 1.0.8 — 2020-10-18
- 1.0.7 — 2020-10-18
- 1.0.6 — 2020-10-14
- 1.0.5 — 2020-10-14
- 1.0.4 — 2020-10-14
- 1.0.3 — 2020-10-14
- 1.0.2 — 2020-10-14
- 1.0.1 — 2020-10-14
- 1.0.0 — 2020-10-14

## README

# react-subwindow

> A react way to create modals and some useful utility functions

[![NPM](https://img.shields.io/npm/v/react-subwindow.svg)](https://www.npmjs.com/package/react-subwindow) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save react-subwindow
```

## Usage

```jsx
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
```js
import { createSubwindow, onConfirmationPopup, getZIndex, releaseZIndex } from 'react-subwindow'
```

#### `createSubwindow(reactElement)`

__Example__

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

#### `onConfirmationPopup(title, onConfirm)`

__Example__

```js
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](https://github.com/Raufoon)

---
_Source: https://npm.io/package/react-subwindow · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
