All files / src/Footer Footer.js

100% Statements 6/6
100% Branches 1/1
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73                12x                             12x 1x 1x                                                               12x                              
import React from 'react';
import * as R from 'ramda';
import PropTypes from 'prop-types';
import { makeStyles } from '@material-ui/core/styles';
import Typography from '@material-ui/core/Typography';
import Grid from '@material-ui/core/Grid';
import Tooltip from '../Tooltip/Tooltip';
 
const useStyles = makeStyles(theme => ({
  font: {
    color: '#7A7A7A',
  },
  tooltip: {
    backgroundColor: theme.palette.common.white,
  },
  spaceContainer: {
    paddingLeft: theme.spacing(1.5),
  },
  gridContainer: {
    padding: theme.spacing(0.5, 1.5),
  },
}));
 
const Footer = ({ tooltip, label, logo, link, linkLabel, height = 25 }) => {
  const classes = useStyles();
  return (
    <Grid container direction="row" alignItems="center" spacing={2}>
      <Grid item xs={1} className={classes.gridContainer}>
        <Tooltip
          placement="top"
          interactive
          title={
            <Typography variant="body1">
              <Typography variant="inherit">{R.prop('label')(tooltip)}</Typography>
              <a className={classes.spaceContainer} href={R.prop('link')(tooltip)}>
                {R.prop('linkLabel')(tooltip)}
              </a>
            </Typography>
          }
        >
          <Typography variant="body1" className={classes.font}>
            {R.ifElse(R.isNil, R.always('©'), R.identity)(label)}
          </Typography>
        </Tooltip>
      </Grid>
      <Grid item xs={11} className={classes.gridContainer}>
        <Grid container justify="flex-end">
          <Typography variant="body1" className={classes.font}>
            <a href={link}>{linkLabel}</a>
          </Typography>
          <img className={classes.spaceContainer} height={height} src={logo} />
        </Grid>
      </Grid>
    </Grid>
  );
};
 
Footer.propTypes = {
  tooltip: PropTypes.shape({
    link: PropTypes.string,
    linkLabel: PropTypes.string,
    label: PropTypes.string,
  }),
  label: PropTypes.string,
  logo: PropTypes.string,
  link: PropTypes.string,
  linkLabel: PropTypes.string,
  height: PropTypes.number,
  classes: PropTypes.object,
};
 
export default Footer;