-
Notifications
You must be signed in to change notification settings - Fork 598
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move ApplicationMain to shared library
Summary: ApplicationMain can/should be shared between components Reviewed By: noamsch Differential Revision: D17145474 fbshipit-source-id: e9d48f763d67dfc298b918eab1453f235447089f
- Loading branch information
1 parent
c610c85
commit e1f567c
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
nms/fbcnms-packages/fbcnms-ui/components/ApplicationMain.js
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,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; |