import React from "react";
import { Button } from "antd";
import type { ButtonProps } from "antd";

export type BAButtonProps = ButtonProps & {
    label?: React.ReactNode;
    sx?: React.CSSProperties;
};

const BAButton = React.forwardRef<HTMLButtonElement, BAButtonProps>(
    ({ label, children, sx, style, type = "primary", ...rest }, ref) => {
        return (
            <Button
                ref={ref}
                type={type}
                style={{ ...style, ...sx }}
                {...rest}
            >
                {label ?? children}
            </Button>
        );
    }
);

BAButton.displayName = "BAButton";

export default BAButton;
