# react-transform-modal

> modify transform effect

Latest version **0.1.4** (published 2020-04-27) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2020-04-27 |
| First published | 2020-04-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 7 |
| Unpacked size | 1.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | chenhx |
| Maintainers | chenhx |
| Keywords | react, transform, modal |

## Links

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

## Dependencies (7)

- [react](https://npm.io/package/react.md) ^16.8
- [react-dom](https://npm.io/package/react-dom.md) ^16.8
- [prop-types](https://npm.io/package/prop-types.md) ^15.7.2
- [is-plain-object](https://npm.io/package/is-plain-object.md) ^3.0.0
- [react-tiny-portal](https://npm.io/package/react-tiny-portal.md) ^0.1.0
- [hyphenate-style-name](https://npm.io/package/hyphenate-style-name.md) ^1.0.3
- [inline-style-prefixer](https://npm.io/package/inline-style-prefixer.md) ^6.0.0

## 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

- 0.1.4 (latest) — 2020-04-27
- 0.1.3 — 2020-04-23
- 0.1.2 — 2020-04-23
- 0.1.1 — 2020-04-22
- 0.1.0 — 2020-04-17

## README

# Introduction

inspired by [the container transform pattern of Material Design motion system](https://www.material.io/design/motion/the-motion-system.html#container-transform)

![images](./modal.gif)

[demo address](https://chenhx2015.github.io/react-transform-modal/)

# usage

1. Import dependencies and module method

```javascript
import React from "react";
import { render } from "react-dom";
import useModal from "react-transform-modal";
```

2. Build UI

- Modal : this component can wrap other element like title , content and button
- open: open the modal
- close: close the modal
- styleModalContent: the style of modal
- styleModalHeader: the style of modal's header

```javascript
const ExampleModal = () => {
  const { Modal, open, close } = useModal();

  return (
    <div>
      <p>
        <button onClick={open}>Open</button>
      </p>
      <Modal>
        <div style={styleModalContent}>
          <div style={styleModalHeader}>
            <h5>Title</h5>
            <button style={styleModalClose} onClick={close} type="button">
              <span aria-hidden="true">&times;</span>
            </button>
          </div>
          <div>
            <p style={stylePl}>
              You can also close me by pressing the &quot;ESC&quot; key.</br>
              This is the content area...
            </p>
          </div>
        </div>
      </Modal>
    </div>
  );
};

function App() {
  return (
    <div>
      <ExampleModal />
    </div>
  );
}

```

3. render the modal

```javascript
render(<App />, document.getElementById("root"));
```

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