All files / src/pages/SearchProjects ResultFilters.js

75% Statements 6/8
50% Branches 1/2
66.67% Functions 2/3
71.43% Lines 5/7

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          61x                               61x 36x 36x                                   36x        
import React from 'react';
import Box from '@material-ui/core/Box';
import Typography from '@material-ui/core/Typography';
import { makeStyles } from '@material-ui/styles';
 
const useStyles = makeStyles((theme) => ({
  clear: {
    '&:hover': {
      cursor: 'pointer',
    },
  },
  filters: {
    alignItems: 'center',
    display: 'flex',
    flexWrap: 'wrap',
    '& p': {
      marginRight: theme.spacing(1),
    },
  },
}));
 
const ResultFilters = ({ show, filterTags, onFilterChange }) => {
  const classes = useStyles();
  Iif (show) {
    return (
      <Box className={classes.filters}>
        <Typography variant='body1'>
          <b>Filter: </b>
        </Typography>
        {filterTags}
        <Typography
          variant='body1'
          color='secondary'
          className={classes.clear}
          onClick={() => onFilterChange({ category: 'all' }, true)}
        >
          <b>Clear all</b>
        </Typography>
      </Box>
    );
  }
  return null;
};
 
export default ResultFilters;