import React from 'react'
import './Buttons.css'

function SubmitButton({ loading, disabled, children, onClick, type = 'button', ...props }) {
  const displayText = loading ? 'Сохранение...' : (children || 'Сохранить')
  
  return (
    <button
      type={type}
      className="submit-button"
      onClick={onClick}
      disabled={disabled || loading}
      {...props}
    >
      {displayText}
    </button>
  )
}

export default SubmitButton
