Skip to content

Commit

Permalink
Move ApplicationMain to shared library
Browse files Browse the repository at this point in the history
Summary: ApplicationMain can/should be shared between components

Reviewed By: noamsch

Differential Revision: D17145474

fbshipit-source-id: e9d48f763d67dfc298b918eab1453f235447089f
  • Loading branch information
rckclmbr authored and facebook-github-bot committed Sep 3, 2019
1 parent c610c85 commit e1f567c
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions nms/fbcnms-packages/fbcnms-ui/components/ApplicationMain.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/

import * as React from 'react';
import AppContext from '@fbcnms/ui/context/AppContext';
import CssBaseline from '@material-ui/core/CssBaseline';
import MuiStylesThemeProvider from '@material-ui/styles/ThemeProvider';
import MuiThemeProvider from '@material-ui/core/styles/MuiThemeProvider';
import defaultTheme from '@fbcnms/ui/theme/default';
import {SnackbarProvider} from 'notistack';
import {TopBarContextProvider} from '@fbcnms/ui/components/layout/TopBarContext';

type Props = {
appContext: any,
children: React.Element<*>,
};

const ApplicationMain = (props: Props) => {
return (
<MuiThemeProvider theme={defaultTheme}>
<MuiStylesThemeProvider theme={defaultTheme}>
<SnackbarProvider
maxSnack={3}
autoHideDuration={10000}
anchorOrigin={{
vertical: 'bottom',
horizontal: 'right',
}}>
<AppContext.Provider value={props.appContext}>
<TopBarContextProvider>
<CssBaseline />
{props.children}
</TopBarContextProvider>
</AppContext.Provider>
</SnackbarProvider>
</MuiStylesThemeProvider>
</MuiThemeProvider>
);
};

export default ApplicationMain;

0 comments on commit e1f567c

Please sign in to comment.