react-motion-modal 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +25 -3
  2. package/dist/index.js +3427 -3809
  3. package/package.json +14 -12
package/README.md CHANGED
@@ -19,7 +19,7 @@ npm install react-motion-modal
19
19
  or with yarn:
20
20
 
21
21
  ```bash
22
- yarn add react-motion-modal
22
+ yarn add react-motion-modal zustand
23
23
  ```
24
24
 
25
25
  ## 🚀 Usage
@@ -44,7 +44,29 @@ declare module 'react-motion-modal' {
44
44
  }
45
45
  ```
46
46
 
47
- ### 2. Open modal anywhere
47
+ ### 2. Import <ModalProvider />
48
+
49
+ Import <ModalProvider /> to define your modals
50
+
51
+ ```ts
52
+ import { ModalProvider } from 'react-motion-modal';
53
+
54
+ export const App = () => {
55
+
56
+ return <div>
57
+ {...rest-of-your-app}
58
+
59
+ <ModalProvider
60
+ modals={{
61
+ AlertModal,
62
+ ConfirmModal,
63
+ }}
64
+ />
65
+ <div/>
66
+ }
67
+ ```
68
+
69
+ ### 3. Open modal anywhere
48
70
 
49
71
  ```tsx
50
72
  import { useModal } from 'react-motion-modal';
@@ -56,7 +78,7 @@ openModal('ConfirmModal', {1
56
78
  });
57
79
  ```
58
80
 
59
- ### 3. Use `closeModal` inside your modal component
81
+ ### 4. Use `closeModal` inside your modal component
60
82
 
61
83
  ```tsx
62
84
  const ConfirmModal = ({ title, closeModal }: ModalDefinition<'ConfirmModal'>) => (