// This file is part of Coog. The COPYRIGHT file at the top level of
// this repository contains the full copyright notices and license terms.

import React, { FC } from 'react';

import cn from 'classnames';

import { ConfirmationButtonProps } from './ConfirmationButton.types';

import './ConfirmationButton.scss';

/**
 * ConfirmationButton component
 * @param props
 * @returns {XML}
 * @constructor
 */
const ConfirmationButton: FC<ConfirmationButtonProps> = ({
  label,
  disabled = false,
  isBtnOpen = false,
  handlerMainButton,
  children,
}: ConfirmationButtonProps): JSX.Element => (
  <div className="confirmation-173c9e28-e81d-4e13-a531-40038480ce4e">
    {isBtnOpen ? (
      children
    ) : (
      <button
        className={cn(`button button-primary`, { disabled })}
        type="button"
        disabled={disabled}
        onClick={handlerMainButton}
      >
        {label}
      </button>
    )}
  </div>
);

export default ConfirmationButton;

export { ConfirmationButtonProps };
