Skip to content

Commit 97be864

Browse files
committed
footer templates
1 parent 5480826 commit 97be864

File tree

3 files changed

+91
-0
lines changed

3 files changed

+91
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import _ from 'lodash';
2+
import React from 'react';
3+
import PropTypes from 'prop-types';
4+
import { withStyles } from 'material-ui/styles';
5+
import Grid from 'material-ui/Grid';
6+
import Typography from 'material-ui/Typography';
7+
import Button from 'material-ui/Button';
8+
9+
import styles from './styles';
10+
11+
class BasicFooter extends React.PureComponent {
12+
static propTypes = {
13+
title: PropTypes.string,
14+
smallMessage: PropTypes.string,
15+
bigMessage: PropTypes.string,
16+
classes: PropTypes.shape({}),
17+
logo: PropTypes.string,
18+
links: PropTypes.arrayOf(PropTypes.shape({})),
19+
};
20+
static defaultProps = {
21+
title: 'Brand',
22+
};
23+
24+
renderLogo = () => {
25+
const { classes, title, logo } = this.props;
26+
if (logo) {
27+
return <img src={logo} alt={title} className={classes.logoImage} />;
28+
}
29+
return (
30+
<Typography type="title" color="inherit" className={classes.flex}>
31+
{title}
32+
</Typography>
33+
);
34+
};
35+
36+
render() {
37+
const { title, classes, smallMessage, bigMessage, links } = this.props;
38+
return (
39+
<Grid container align="flex-end" justify="space-around" spacing={16}>
40+
<Grid item xs={12}>
41+
<div className={classes.message}>
42+
<Typography type="display3" color="inherit">
43+
{bigMessage}
44+
</Typography>
45+
</div>
46+
</Grid>
47+
<Grid item xs={12} md={4}>
48+
<Grid container direction="row" spacing={0} justify="center">
49+
{_.map(links, link => (
50+
<Button href={link.href} color="inherit" key={link.label}>{link.label}</Button>
51+
))}
52+
</Grid>
53+
</Grid>
54+
<Grid item xs={12} md={4}>
55+
<Grid container direction="column" align="center" spacing={0}>
56+
<Typography type="body1" color="inherit">
57+
{smallMessage}
58+
</Typography>
59+
<Typography type="caption" color="inherit">
60+
{title} © {new Date().getFullYear()}
61+
</Typography>
62+
</Grid>
63+
</Grid>
64+
<Grid item xs={12} md={4}>
65+
<Grid container justify="center">
66+
{this.renderLogo()}
67+
</Grid>
68+
</Grid>
69+
</Grid>
70+
);
71+
}
72+
}
73+
74+
export default withStyles(styles)(BasicFooter);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import BasicFooter from './BasicFooter';
2+
3+
export default BasicFooter;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const styles = () => ({
2+
message: {
3+
textAlign: 'center',
4+
marginBottom: '30px',
5+
},
6+
logoImage: {
7+
maxHeight: '50px',
8+
maxWidth: '300px',
9+
margin: '0',
10+
padding: '0',
11+
},
12+
});
13+
14+
export default styles;

0 commit comments

Comments
 (0)