|
| 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); |
0 commit comments