This repository has been archived by the owner on Apr 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
39 additions
and
1 deletion.
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,37 @@ | ||
/* globals APP_NAME */ | ||
import React, { PropTypes } from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { Link } from 'react-router'; | ||
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; | ||
import AppBar from 'material-ui/AppBar'; | ||
import CircularProgress from 'material-ui/CircularProgress'; | ||
import Notification from 'admin-on-rest/lib/mui/layout/Notification'; | ||
import Menu from 'admin-on-rest/lib/mui/layout/Menu'; | ||
const Title = <Link to="/" style={{ color: '#fff', textDecoration: 'none' }}>{APP_NAME} - Administration</Link>; | ||
|
||
const Layout = ({ isLoading, children, route }) => ( | ||
<MuiThemeProvider> | ||
<div style={{ display: 'flex', flexDirection: 'column', minHeight: '100vh' }}> | ||
<AppBar title={Title} iconElementRight={isLoading ? <CircularProgress color="#fff" size={0.5} /> : <span/> } /> | ||
<div className="body" style={{ display: 'flex', flex: '1', backgroundColor: '#edecec' }}> | ||
<div style={{ flex: 1 }}>{children}</div> | ||
<Menu resources={route.resources} /> | ||
</div> | ||
<Notification /> | ||
</div> | ||
</MuiThemeProvider> | ||
); | ||
|
||
Layout.propTypes = { | ||
isLoading: PropTypes.bool.isRequired, | ||
children: PropTypes.node, | ||
route: PropTypes.object.isRequired, | ||
}; | ||
|
||
function mapStateToProps(state) { | ||
return { isLoading: state.admin.loading > 0 }; | ||
} | ||
|
||
export default connect( | ||
mapStateToProps, | ||
)(Layout); |
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