All files / src/components/common/Table RiskLevelTag.tsx

0% Statements 0/5
0% Branches 0/13
0% Functions 0/2
0% Lines 0/4

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                                                                                                         
import { Box, styled } from "@mui/material";
import { palette } from "@palette";
 
type RiskLevelTagProp = {
  isSuspended: boolean;
  levelColor: any;
  statusName: string | undefined;
  riskLevelLabel: string;
  hasBorder?: boolean;
  customStyle?: any;
  testId?: string;
};
 
export const RiskLevelTag = ({
  isSuspended,
  levelColor,
  statusName,
  riskLevelLabel,
  hasBorder = true,
  customStyle,
  testId,
}: RiskLevelTagProp) => {
  const { color, background } = levelColor || {};
  return (
    <RiskLevel
      data-testid={testId}
      sx={{
        color: isSuspended ? palette.tag.warning.hover : color,
        backgroundColor: isSuspended ? palette.tag.warning.bg : background,
        border: hasBorder
          ? `1px solid ${isSuspended ? palette.tag.warning.hover : color}`
          : "none",
        ...customStyle,
      }}
    >
      {isSuspended ? statusName : riskLevelLabel}
    </RiskLevel>
  );
};
 
const RiskLevel = styled(Box)(() => ({
  padding: "4px 16px",
  borderRadius: "100px",
  fontSize: 14,
  lineHeight: "120%",
  fontWeight: 400,
  display: "flex",
  justifyContent: "center",
  minWidth: "82px",
  maxWidth: "100px",
  textTransform: "capitalize",
}));