All files / src/buttons fms-button.tsx

100% Statements 6/6
82.35% Branches 14/17
100% Functions 2/2
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 411x 1x 1x                           1x               15x                             1x  
import React, { FunctionComponent, MouseEventHandler, ReactNode } from "react";
import { Button } from "antd";
import classes from "./styles.module.css";
 
export type ButtonTypes = "primary" | "secondary" | "traity" | "link" | "danger" | "move";
 
interface fmsButtonProps {
  children: ReactNode;
  disabled?: boolean;
  borderRadius?: 0 | 8 | 32;
  type?: ButtonTypes;
  size?: "small" | "middle" | "large";
  onClick?: MouseEventHandler<HTMLAnchorElement> &
    MouseEventHandler<HTMLButtonElement>;
}
 
const FmsButton: FunctionComponent<fmsButtonProps> = ({
  children,
  borderRadius = 0,
  type = "primary",
  size = "middle",
  onClick = () => {},
  disabled = false,
}) => {
  return (
    <Button
      data-testid="fms-button"
      className={`${classes.button} ${classes?.[type]} ${classes?.[size]} ${
        classes?.[`radius-${borderRadius}`]
      }`}
      size={size}
      onClick={onClick}
      disabled={disabled}
    >
      {children}
    </Button>
  );
};
 
export default FmsButton;