All files / src/features/MerchantPortal/DeveloperApi/components ApiKeyStatus.tsx

100% Statements 6/6
100% Branches 4/4
100% Functions 3/3
100% Lines 6/6

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        2x             2x             232x                         2x 1162x 232x            
import GiveChip, { TChipColors } from "@shared/Chip/GiveChip";
import { styled } from "@theme/v2/Provider";
import { API_KEY_STATUSES_ENUM } from "../types";
 
const colorsMap: Record<string, TChipColors> = {
  [API_KEY_STATUSES_ENUM.ACTIVE]: "success",
  [API_KEY_STATUSES_ENUM.REVOKED]: "error",
  [API_KEY_STATUSES_ENUM.DECLINED]: "error",
  [API_KEY_STATUSES_ENUM.SUSPENDED]: "default",
};
 
const ApiKeyStatus = ({
  label,
  isMobile,
}: {
  label: string;
  isMobile?: boolean;
}) => {
  return (
    <StyledChip
      color={colorsMap[label]}
      label={label}
      size="large"
      variant="light"
      isMobile={isMobile}
    />
  );
};
 
export default ApiKeyStatus;
 
const StyledChip = styled(GiveChip, {
  shouldForwardProp: (prop) => prop !== "isMobile",
})<{ isMobile?: boolean }>(({ isMobile }) => ({
  width: isMobile ? "unset" : "135px",
  minWidth: isMobile ? "unset" : "135px",
  height: "26px",
  fontSize: "12px",
}));