"use client";

import React from "react";
import styles from "@/components/ui/Button/button.module.css";

/**
 * A generic button component.
 * @type {React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & {
 *    children: React.ReactNode;
 *    className?: string;
 *    type?: "button" | "submit" | "reset" | undefined;
 *    disabled?: boolean;
 *    style?: React.CSSProperties;
 *    ref: React.RefObject;
 *    action: Function;
 *    onClick?: React.MouseEventHandler<HTMLButtonElement>;
 * }>}
 */
const Button = (props) => {
  return (
    <button
      ref={props.ref}
      type={props.type}
      style={props.style}
      title={props.title}
      disabled={props.disabled}
      className={`${styles.button} ${props.className}`}
      onClick={props.onClick || props.action}>
      {props.children}
    </button>
  );
};

export default Button;
