Skip to content

Commit 3d743d2

Browse files
committed
now it works more similar to the AppBar API
1 parent 1f61e07 commit 3d743d2

File tree

2 files changed

+33
-22
lines changed

2 files changed

+33
-22
lines changed

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;

0 commit comments

Comments
 (0)