Skip to content

Commit fc96c67

Browse files
authored
Merge pull request #49 from OrigenStudio/develop
new release candidate - v.0.1.0-rc.1
2 parents 5254487 + 1ab8bc0 commit fc96c67

File tree

8 files changed

+64
-28
lines changed

8 files changed

+64
-28
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "material-ui-layout",
3-
"version": "0.1.0-rc.0",
3+
"version": "0.1.0-rc.1",
44
"description": "Layout components for material-ui",
55
"main": "./lib/index.js",
66
"scripts": {

src/components/Footer/Footer.jsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { withStyles } from '@material-ui/core/styles';
4+
import classNames from 'classnames';
5+
import capitalize from 'lodash/capitalize';
46

57
import styles from './styles';
68

@@ -11,12 +13,15 @@ class Footer extends React.PureComponent {
1113
};
1214

1315
render() {
14-
const { classes, children } = this.props;
15-
return (
16-
<div className={classes.footer}>
17-
{children}
18-
</div>
16+
const { classes, color, className: classNameProp, children } = this.props;
17+
const className = classNames(
18+
classes.footer,
19+
{
20+
[classes[`color${capitalize(color)}`]]: color !== 'inherit',
21+
},
22+
classNameProp
1923
);
24+
return <div className={className}>{children}</div>;
2025
}
2126
}
2227

src/components/Footer/styles.js

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1-
const styles = theme => ({
2-
footer: {
3-
backgroundColor: theme.palette.background.appBar,
4-
color: theme.palette.getContrastText(theme.palette.background.appBar),
5-
padding: '20px 10px',
6-
},
7-
message: {
8-
textAlign: 'center',
9-
marginBottom: '30px',
10-
},
11-
logoImage: {
12-
maxHeight: '50px',
13-
maxWidth: '300px',
14-
margin: '0',
15-
padding: '0',
16-
},
17-
});
1+
const styles = theme => {
2+
const backgroundColorDefault =
3+
theme.palette.type === 'light'
4+
? theme.palette.grey[100]
5+
: theme.palette.grey[900];
6+
return {
7+
footer: {
8+
padding: '20px 10px', // TODO use units and spacing
9+
},
10+
colorDefault: {
11+
backgroundColor: backgroundColorDefault,
12+
color: theme.palette.getContrastText(backgroundColorDefault),
13+
},
14+
colorPrimary: {
15+
backgroundColor: theme.palette.primary.main,
16+
color: theme.palette.primary.contrastText,
17+
},
18+
colorSecondary: {
19+
backgroundColor: theme.palette.secondary.main,
20+
color: theme.palette.secondary.contrastText,
21+
},
22+
};
23+
};
1824

1925
export default styles;

src/components/Layout/Layout.jsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import styles from './styles';
1111

1212
import AppBar from '../AppBar';
1313
import Footer from '../Footer';
14+
import LayoutActions from './LayoutActions';
1415

1516
// FIXME remove once material-ui drawer style is fixed
1617
const isDocked = type => type === 'permanent' || type === 'persistent';
@@ -222,7 +223,16 @@ class Layout extends React.PureComponent {
222223
{rightDrawerContentWithProps}
223224
</Drawer>
224225
) : null}
225-
<main className={mainClassnames}>{children}</main>
226+
<LayoutActions.Provider
227+
value={{
228+
toggleLeftDrawer: this.toggleLeftDrawer,
229+
toggleRightDrawer: this.toggleRightDrawer,
230+
handleLeftDrawerClose: this.handleLeftDrawerClose,
231+
handleRightDrawerClose: this.handleRightDrawerClose,
232+
}}
233+
>
234+
<main className={mainClassnames}>{children}</main>
235+
</LayoutActions.Provider>
226236
{footerContent ? (
227237
<Footer {...footerProps}>{footerContent}</Footer>
228238
) : null}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
3+
const LayoutActions = React.createContext({
4+
toggleLeftDrawer: () => {},
5+
toggleRightDrawer: () => {},
6+
handleRightDrawerClose: () => {},
7+
handleLeftDrawerClose: () => {},
8+
});
9+
10+
export default LayoutActions;

src/components/Layout/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
import Layout from './Layout';
2+
import LayoutActions from './LayoutActions';
23

4+
export { LayoutActions };
35
export default Layout;

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import Layout from './components/Layout';
1+
import Layout, { LayoutActions } from './components/Layout';
22

3+
export { LayoutActions };
34
export { default as AppBar } from './components/AppBar';
45
export { default as Footer } from './components/Footer';
56

6-
77
export { default as BasicAppBar } from './templates/AppBar/BasicAppBar';
88
export { default as TwoRowsAppBar } from './templates/AppBar/TwoRowsAppBar';
99
export { default as BasicFooter } from './templates/Footer/BasicFooter';

src/templates/Drawer/DrawerItemsList/DrawerItemsList.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import map from 'lodash/map';
22
import React from 'react';
33
import PropTypes from 'prop-types';
44
import { withStyles } from '@material-ui/core/styles';
5-
import List, { ListItem, ListItemIcon, ListItemText } from '@material-ui/core/List';
5+
import List from '@material-ui/core/List';
6+
import ListItem from '@material-ui/core/ListItem';
7+
import ListItemIcon from '@material-ui/core/ListItemIcon';
8+
import ListItemText from '@material-ui/core/ListItemText';
69
import Icon from '@material-ui/core/Icon';
710

811
import styles from './styles';
@@ -13,7 +16,7 @@ class DrawerItemsList extends React.PureComponent {
1316
classes: PropTypes.shape({}),
1417
};
1518

16-
renderIcon = (item) => {
19+
renderIcon = item => {
1720
if (item.icon) {
1821
return <item.icon />;
1922
} else if (item.iconName) {

0 commit comments

Comments
 (0)