All files / app/components/Bar BarWithHelp.tsx

100% Statements 9/9
50% Branches 1/2
100% Functions 2/2
100% Lines 8/8

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 424x 4x 4x 4x   4x                 8x           8x           8x                              
import { IconButton, styled, Tooltip } from "@mui/material";
import { HelpIcon } from "components/Icons";
import React from "react";
import { theme } from "theme";
 
import ScoreBar from "./ScoreBar";
 
interface BarWithHelpProps {
  value: number;
  label: string;
  description: string;
  className?: string;
}
 
const StyledWrapper = styled("div")(({ theme }) => ({
  alignItems: "center",
  display: "flex",
  marginBottom: theme.spacing(2),
}));
 
export default function BarWithHelp({
  value,
  label,
  description,
  className,
}: BarWithHelpProps) {
  return process.env.NEXT_PUBLIC_IS_POST_BETA_ENABLED ? (
    <StyledWrapper className={className}>
      <ScoreBar value={value}>{label}</ScoreBar>
      <Tooltip title={description}>
        <IconButton
          aria-label="help icon"
          size="large"
          sx={{ padding: 0, paddingLeft: theme.spacing(1) }}
        >
          <HelpIcon />
        </IconButton>
      </Tooltip>
    </StyledWrapper>
  ) : null;
}