import React from 'react';
import { useButton, AriaButtonProps } from 'react-aria';

interface ModalOpeningButtonProps extends AriaButtonProps<'button'> {
  className?: string;
  children?: React.ReactNode;
  isDisabled?: boolean;
  title?: string;
}

export function ModalOpeningButton({ className, children, title, ...props }: ModalOpeningButtonProps) {
  const ref = React.useRef<HTMLButtonElement>(null);

  const { buttonProps } = useButton(props, ref);
  return (
    <button {...buttonProps} ref={ref} className={className} title={title}>
      {children}
    </button>
  );
}
