All files / app/components/Bar BarWithHelp.tsx

100% Statements 11/11
50% Branches 1/2
100% Functions 2/2
100% Lines 10/10

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 474x 4x 4x 4x 4x   4x   4x                                       4x           8x 8x                      
import { IconButton, Tooltip } from "@material-ui/core";
import classNames from "classnames";
import { HelpIcon } from "components/Icons";
import React from "react";
import makeStyles from "utils/makeStyles";
 
import ScoreBar from "./ScoreBar";
 
const useStyles = makeStyles((theme) => ({
  button: {
    padding: 0,
    paddingLeft: theme.spacing(1),
  },
 
  root: {
    alignItems: "center",
    display: "flex",
    marginBottom: theme.spacing(2),
  },
}));
 
interface BarWithHelpProps {
  value: number;
  label: string;
  description: string;
  className?: string;
}
 
export default function BarWithHelp({
  value,
  label,
  description,
  className,
}: BarWithHelpProps) {
  const classes = useStyles();
  return process.env.NEXT_PUBLIC_IS_POST_BETA_ENABLED ? (
    <div className={classNames(classes.root, className)}>
      <ScoreBar value={value}>{label}</ScoreBar>
      <Tooltip title={description}>
        <IconButton aria-label="help icon" className={classes.button}>
          <HelpIcon />
        </IconButton>
      </Tooltip>
    </div>
  ) : null;
}