@machinemetrics/mm-react-tools 2.2.0-dev → 3.0.0
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.
- package/README.md +11 -10
- package/dist/mm-react-tools.es.js +30642 -0
- package/dist/mm-react-tools.umd.js +165 -0
- package/package.json +20 -44
- package/dist/index.js +0 -2082
- package/dist/index.js.map +0 -1
- package/dist/index.modern.js +0 -2066
- package/dist/index.modern.js.map +0 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Components, hooks, and helper functions for writing React apps using MachineMetr
|
|
|
14
14
|
## Install
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
|
|
17
|
+
npm install @machinemetrics/mm-react-tools
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## Peer Dependencies
|
|
@@ -22,7 +22,7 @@ yarn add mm-react-tools
|
|
|
22
22
|
Due to how Apollo, React, and other libraries work, there are some additional dependencies that you'll need to include in your project:
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
|
|
25
|
+
npm install react react-router-dom styled-components @apollo/client
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## Getting Started
|
|
@@ -32,12 +32,11 @@ Wrap your application in the `MMProvider` to wire up everything necessary to aut
|
|
|
32
32
|
```jsx
|
|
33
33
|
import React from 'react';
|
|
34
34
|
import ReactDOM from 'react-dom';
|
|
35
|
-
import { MMProvider } from 'mm-react-tools';
|
|
35
|
+
import { MMProvider } from '@machinemetrics/mm-react-tools';
|
|
36
36
|
import App from './App';
|
|
37
37
|
|
|
38
38
|
ReactDOM.render(
|
|
39
39
|
<MMProvider
|
|
40
|
-
domain={process.env.REACT_APP_URL}
|
|
41
40
|
clientId={process.env.REACT_APP_CLIENT_ID}
|
|
42
41
|
clientSecret={process.env.REACT_APP_CLIENT_SECRET}
|
|
43
42
|
releaseStage={process.env.REACT_APP_RELEASE_STAGE}
|
|
@@ -56,17 +55,19 @@ Use the `ProtectedRoute` to kick off the login flow.
|
|
|
56
55
|
```jsx
|
|
57
56
|
// App.js
|
|
58
57
|
import React from 'react';
|
|
59
|
-
import { Route } from 'react-router-dom';
|
|
60
|
-
import { PrivateLayout } from 'mm-react-tools';
|
|
58
|
+
import { Route, Routes } from 'react-router-dom';
|
|
59
|
+
import { PrivateLayout } from '@machinemetrics/mm-react-tools';
|
|
61
60
|
import PublicPage from './PublicPage';
|
|
62
61
|
import PrivatePage from './PrivatePage';
|
|
63
62
|
|
|
64
63
|
function App() {
|
|
65
64
|
return (
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
<Route
|
|
69
|
-
|
|
65
|
+
<Routes>
|
|
66
|
+
<Route exact path='/public' element={<PublicPage />} />
|
|
67
|
+
<Route element={<PrivateLayout />}>
|
|
68
|
+
<Route path="/private" element={<PrivatePage />}>
|
|
69
|
+
</Route>
|
|
70
|
+
<Routes>
|
|
70
71
|
);
|
|
71
72
|
}
|
|
72
73
|
|