-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from erwanMarmelab/main
Upgrade to RA v5
- Loading branch information
Showing
37 changed files
with
1,740 additions
and
3,667 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"warnOnUnsupportedTypeScriptVersion": false | ||
}, | ||
"extends": ["react-app", "plugin:prettier/recommended"], | ||
"plugins": [ | ||
"@typescript-eslint", | ||
"import", | ||
"jsx-a11y", | ||
"prettier", | ||
"react", | ||
"react-hooks" | ||
], | ||
"rules": { | ||
"no-use-before-define": "off", | ||
"prettier/prettier": "error", | ||
"no-restricted-imports": [ | ||
"error", | ||
{ | ||
"paths": [ | ||
{ | ||
"name": "@mui/material", | ||
"importNames": ["makeStyles", "createMuiTheme"], | ||
"message": "Please import from @mui/material/styles instead. See https://material-ui.com/guides/minimizing-bundle-size/#option-2 for more information" | ||
} | ||
] | ||
} | ||
], | ||
"no-redeclare": "off", | ||
"import/no-anonymous-default-export": "off", | ||
"@typescript-eslint/no-redeclare": ["error"], | ||
"no-unused-vars": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"warn", // or "error" | ||
{ | ||
"argsIgnorePattern": "^_", | ||
"varsIgnorePattern": "^_", | ||
"caughtErrorsIgnorePattern": "^_", | ||
"ignoreRestSiblings": true | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
arrowParens: 'avoid', | ||
bracketSpacing: true, | ||
bracketSameLine: false, | ||
jsxSingleQuote: false, | ||
printWidth: 80, | ||
quoteProps: 'as-needed', | ||
rangeStart: 0, | ||
rangeEnd: Infinity, | ||
semi: true, | ||
singleQuote: true, | ||
tabWidth: 4, | ||
trailingComma: 'es5', | ||
useTabs: false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,68 @@ | ||
## 2.0.0 | ||
|
||
- Upgrade `react-admin` to v5 | ||
- Remove prop-types | ||
|
||
### Breaking Changes | ||
|
||
The `initGoogleAuthProvider` helper has been replaced by a hook -- `useGoogleAuthProvider` -- and a React Context Provider -- `<GoogleAuthContextProvider>`. | ||
|
||
Here is how to use them in replacement of the `initGoogleAuthProvider` helper: | ||
|
||
```diff | ||
// in src/App.tsx | ||
import React from "react"; | ||
import { Admin, Resource, Login, CustomRoutes } from "react-admin"; | ||
import { Route } from "react-router-dom"; | ||
-import { initGoogleAuthProvider } from "ra-auth-google"; | ||
+import { useGoogleAuthProvider, LoginButton, OneTapButton, GoogleAuthContextProvider } from "ra-auth-google"; | ||
import dataProvider from "./dataProvider"; | ||
import posts from "./posts"; | ||
|
||
const App = () => { | ||
- const { authProvider, LoginButton, OneTapButton } = initGoogleAuthProvider(); | ||
+ const { authProvider, gsiParams } = useGoogleAuthProvider(); | ||
|
||
const LoginPage = () => ( | ||
<Login> | ||
<LoginButton /> | ||
</Login> | ||
); | ||
|
||
return ( | ||
+ <GoogleAuthContextProvider value={gsiParams}> | ||
<Admin | ||
authProvider={authProvider} | ||
dataProvider={dataProvider} | ||
title="Example Admin" | ||
loginPage={LoginPage} | ||
> | ||
<Resource name="posts" {...posts} /> | ||
<CustomRoutes> | ||
<Route | ||
path="/custom" | ||
element={ | ||
<div> | ||
<OneTapButton /> | ||
<h1>My Page</h1> | ||
</div> | ||
} | ||
/> | ||
</CustomRoutes> | ||
</Admin> | ||
+ </GoogleAuthContextProvider> | ||
); | ||
}; | ||
export default App; | ||
``` | ||
|
||
**Tip:** The `useGoogleAuthProvider` hook accepts the same parameters as the `initGoogleAuthProvider` helper. | ||
|
||
The (internal) `<GoogleLoginButton>` component was renamed to `<LoginButton>`. | ||
The (internal) `<GoogleOneTapButton>` component was renamed to `<OneTapButton>`. | ||
|
||
Both components now expect to be rendered inside a `<GoogleAuthContextProvider>`. | ||
|
||
## 1.0.0 | ||
|
||
* Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.