All files / src/components/common/SignUp LinearProgress.tsx

100% Statements 8/8
92.85% Branches 13/14
100% Functions 1/1
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64          100x               369x 369x   369x 66x 303x 251x     369x                                                                                  
import { TickIcon } from "@assets/icons";
import { Text } from "@common/Text";
import { LinearProgress, Stack } from "@mui/material";
import { palette } from "@palette";
 
const KotoLinearProgress = ({
  LinearProgressProps,
  svgProps,
  isActive,
  hasDescription,
  isCompletedColor,
  ...rest
}: any) => {
  const isCompleted = rest.value === 100;
  let color = palette.neutral[70];
 
  if (isCompleted && isCompletedColor) {
    color = palette.filled.success;
  } else if (isActive) {
    color = palette.neutral.black;
  }
 
  return (
    <Stack flex={1} justifyContent="flex-start" width="100%">
      {rest.title && (
        <Text mb={1} textAlign="left" color={color}>
          {rest.title}
        </Text>
      )}
      <LinearProgress
        variant="determinate"
        {...rest}
        sx={{
          borderRadius: "90px",
          backgroundColor: "#D1D1D0",
          height: "2px",
          ".MuiLinearProgress-bar": {
            backgroundColor: "neutral.black",
            ...(!isActive && { opacity: ".2" }),
          },
          ...rest.sx,
        }}
        data-testid="stepper-linear-progress"
      />
      {hasDescription && (
        <Stack direction="row" gap={0.5} alignItems="baseline">
          {isCompleted && (
            <TickIcon
              stroke={color}
              width={svgProps?.width}
              height={svgProps?.height}
            />
          )}
          <Text mt={1} textAlign="left" color={color} {...LinearProgressProps}>
            {rest.label}
          </Text>
        </Stack>
      )}
    </Stack>
  );
};
 
export default KotoLinearProgress;