# gr-react-modal

> A simple react modal

Latest version **2.0.7** (published 2021-10-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install gr-react-modal
pnpm add gr-react-modal
yarn add gr-react-modal
bun add gr-react-modal
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.7 |
| Published | 2021-10-08 |
| First published | 2021-10-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 73.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Guillaume Ribeau |
| Maintainers | guillaumeribeau |

## Links

- npm: https://www.npmjs.com/package/gr-react-modal
- npm.io page: https://npm.io/package/gr-react-modal

## Recent versions

- 2.0.7 (latest) — 2021-10-08
- 2.0.6-npm — 2021-10-07
- 2.0.5 — 2021-10-07
- 2.0.4 — 2021-10-07
- 2.0.3 — 2021-10-07
- 2.0.2 — 2021-10-07

## README

# gr-react-modal

## Modal window pluggin for project 14 : 

A simple react modal

1. [Installation](#Installation)
2. [Examples of use](#Example)
3. [Default option](#Default)

<div id='Installation'>

## Installation

You can install gr-react-modal with npm:
`npm i gr-react-modal`

For import rs-react-modal:
`import {Modal} from "gr-react-modal"`

<div id='Example'>

## Examples of use

### Example 1: by default

```js
<Modal
    close = {close}
    open = {active}
/>
```

![Alt text](example/exemple1.png)

### Example 2: with close button only (showClose = true)

```js
const customButton = {
    display: "none"
}

<Modal
    close = {close}
    escape = {false}
    open = {active}
    outside = {false}
    showClose = {true}
    styleButton = {customButton}
/>
```

![Alt text](example/exemple2.png) 

### Example 3: customized

```js
const customContent = {
    background: "#594B94",
    color: "#FFF",
    borderRadius: "0"
}

const customButton = {
    fontSize: "1rem",
    cursor: "pointer",
    fontWeight: "bold",
    background: "#F04329",
    borderColor: "#F04329",
    width: "12rem",
    padding: "1rem",
    borderRadius: ".3rem"
}

<Modal
    buttonContent = "Example button"
    close = {close}
    modalContent = "Example 3"
    open = {active}
    styleButton = {customButton}
    styleContent = {customContent}
/>
```

![Alt text](example/exemple3.png) 

<div id='Default'>

## Default option

### Default content

```js
Modal.defaultProps = {
  buttonContent: "Close", // To customize the button content
  escape: true, // To close the modal by pressing `ESC`
  fadeDelay: null, // Point during the overlay's fade-in that the modal begins to fade in (number between 0 and 1)
  fadeDuration: null, // Number of milliseconds the fade transition takes (null means no transition)
  modalContent: "React modal is open!", // To customize the modal content
  open: false, // To open the modal
  outside: true, // To close the modal by clicking the overlay
  showClose: false, // To activate button x
  styleButton: {}, // To customize button style
  styleButtonX: {}, // To customize button x style
  styleContainer: {}, // To customize overlay style
  styleContent: {} // To customize modal content style
}
```

### Default type

```js
Modal.propTypes = {
  buttonContent: PropTypes.string,
  close: PropTypes.func.isRequired, // REQUIRED - Action when closing
  escape: PropTypes.bool,
  fadeDelay: PropTypes.number,
  fadeDuration: PropTypes.number,
  modalContent: PropTypes.string,
  open: PropTypes.bool.isRequired, // REQUIRED - TRUE to open the modal
  outside: PropTypes.bool,
  showClose: PropTypes.bool,
  styleButton: PropTypes.object,
  styleButtonX: PropTypes.object,
  styleContainer: PropTypes.object,
  styleContent: PropTypes.object
}
```

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