Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Commit

Permalink
feat: add snackbar provider
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Murray <hellomikemurray@gmail.com>
  • Loading branch information
mikemurray committed Apr 8, 2020
1 parent ded7295 commit 54c8e78
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions package/src/App/App.js
Expand Up @@ -5,6 +5,7 @@ import { defaultTheme } from "@reactioncommerce/catalyst";
import { BrowserRouter } from "react-router-dom";
import { AuthenticationProvider, OidcSecure } from "@axa-fr/react-oidc-context";
import { ApolloProvider } from "react-apollo";
import { SnackbarProvider } from "notistack";
import Dashboard from "../Dashboard";

/**
Expand All @@ -18,23 +19,35 @@ function App(props) {
apolloClient,
authenticationProviderProps,
dashboardComponentProps,
plugins
plugins,
snackbarProviderProps: snackbarProps
} = props;

const DashboardComponent = DashboardComponentProp || Dashboard;

const snackbarProviderProps = {
maxSnack: 3,
anchorOrigin: {
vertical: "bottom",
horizontal: "center"
},
...snackbarProps
};

return (
<Suspense fallback={null}>
<ApolloProvider client={apolloClient}>
<BrowserRouter>
<AuthenticationProvider {...authenticationProviderProps}>
<ThemeProvider theme={defaultTheme}>
<OidcSecure>
<DashboardComponent
{...dashboardComponentProps}
plugins={plugins}
/>
</OidcSecure>
<SnackbarProvider {...snackbarProviderProps}>
<OidcSecure>
<DashboardComponent
{...dashboardComponentProps}
plugins={plugins}
/>
</OidcSecure>
</SnackbarProvider>
</ThemeProvider>
</AuthenticationProvider>
</BrowserRouter>
Expand All @@ -48,7 +61,8 @@ App.propTypes = {
apolloClient: PropTypes.object,
authenticationProviderProps: PropTypes.object,
dashboardComponentProps: PropTypes.object,
plugins: PropTypes.arrayOf(PropTypes.object)
plugins: PropTypes.arrayOf(PropTypes.object),
snackbarProviderProps: PropTypes.object
};

export default App;

0 comments on commit 54c8e78

Please sign in to comment.