import React from "react";
import { Button } from "./RooButtonStyles";

export interface RooButtonProps {
  title?: string;
  name?: string;
  type?: "button" | "submit" | "reset" | undefined;
  buttonType?: "primary" | "secondary";
  size?: "xsmall" | "small" | "regular";
  onClick?: (e: any) => void;
  disabled?: boolean;
  style?: object; // additional style
  testId?: string;
  children?: string; // necessary to allow button to have child element
}

export const RooButton: React.FC<RooButtonProps> = (props) => {
  const { style, name, testId, type, onClick, title } = props;
  return (
    <Button
      style={style || {}}
      name={name || ""}
      data-testid={testId}
      type={type || "button"}
      onClick={(event) => {
        if (onClick) onClick(event);
      }}
      {...props}
    >
      {title}
    </Button>
  );
};
