All files / app/components/Bar ScoreBar.tsx

100% Statements 8/8
50% Branches 1/2
100% Functions 2/2
100% Lines 7/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 47 48 49 50 51 52 53 54          4x 4x 4x   4x                                                         4x 8x 8x                          
import {
  Container,
  ContainerProps,
  LinearProgress,
  Typography,
} from "@material-ui/core";
import React from "react";
import makeStyles from "utils/makeStyles";
 
const useStyles = makeStyles((theme) => ({
  root: {
    height: theme.spacing(3),
    marginInlineStart: 0,
    maxWidth: 300,
    position: "relative",
    width: "100%",
  },
  scoreBar: {
    borderRadius: theme.spacing(1.5),
    height: "100%",
    position: "absolute",
    width: "100%",
  },
  scoreBarLabel: {
    color: theme.palette.common.white,
    lineHeight: theme.spacing(3),
    paddingLeft: theme.spacing(2),
    position: "absolute",
    verticalAlign: "middle",
    width: "100%",
    fontSize: "0.75rem",
  },
}));
 
interface ScoreBarProps extends ContainerProps {
  value: number;
}
 
export default function SearchResult({ value, children }: ScoreBarProps) {
  const classes = useStyles();
  return process.env.NEXT_PUBLIC_IS_POST_BETA_ENABLED ? (
    <Container disableGutters className={classes.root}>
      <LinearProgress
        variant="determinate"
        value={value}
        className={classes.scoreBar}
      />
      <Typography className={classes.scoreBarLabel} noWrap>
        {children}
      </Typography>
    </Container>
  ) : null;
}