# my-react-modal

> just a react modal for openclassroom project

Latest version **1.0.11** (published 2022-12-08) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2022-12-08 |
| First published | 2022-11-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 129.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Timothée Picard |
| Maintainers | picard-timothee |
| Keywords | react, modal |

## Links

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

## Dependencies (1)

- [prop-types](https://npm.io/package/prop-types.md) ^15.8.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.11 (latest) — 2022-12-08
- 1.0.10 — 2022-12-02
- 1.0.9 — 2022-12-02
- 1.0.8 — 2022-12-02
- 1.0.7 — 2022-11-27
- 1.0.6 — 2022-11-27
- 1.0.5 — 2022-11-27
- 1.0.4 — 2022-11-27
- 1.0.3 — 2022-11-27
- 1.0.2 — 2022-11-27
- 1.0.1 — 2022-11-27
- 1.0.0 — 2022-11-27

## README

# Component

![logo](./public/logo.jpg)(https://github.com/Timothee-Picard/TimotheePicard_14_25112022)

## Install

Install using `npm i my-react-modal`

## Usage

In a React app, use the Modal components:
`import { Modal } from 'my-react-modal'`

## Modal props

| Name      | Description                                                                                                                                                                           |
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| isShowing | Type: `Boolean` State will display/hide modal                                                                                                                                         |
| hide      | Type: `Function` Function that sets the state to false                                                                                                                                |
| type      | Type: `String or null` Can be success, warning or error                                                                                                                             |
| title     | Type: `String or null`  Set the title of modal                                                                                                                                      |
| messages  | Type: `Array.<String> or null ` Displays children at the bottom of the modal. <br />Can add class modal-action for button design and class success, warning or error for error type |

##  Children

children are added right-aligned in the footer we can add class to set custom design:

| class                | Description                                              |
|----------------------|----------------------------------------------------------|
| modal-action         | Set design to modal button design                        |
| modal-action success | Set design to modal button design and add success color  |
| modal-action error   | Set design to modal button design and add error color    |
| modal-action warning | Set design to modal button design and add warning color  |


## Use it exemple
```
import {useState} from 'react'
import Modal from './lib'

const App = () => {
    const [isShowing, setIsShowing] = useState(false)
    return (
        <>
            <button onClick={() => setIsShowing(true)}>
                Open modal
            </button>
            <Modal isShowing={isShowing}
                   hide={() => setIsShowing(false)}
                   type="error"
                   title="Ma modal"
                   messages={["Modal message 1","My custom message 2"]}
            >
                <button className="modal-action success" onClick={() => setIsShowing(false)}>Return</button>
                <a href="#" className="modal-action">Home</a>
            </Modal>
        </>
    )
}

export default App
```

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