import React from 'react'

import { handleVariant } from './Button.helpers'

import { ButtonProps } from './Button.types'

import './Button.css'

const Button = ({
  children,
  className,
  disabled,
  icon,
  onClick,
  onMouseDown,
  type = 'button',
  variant = 'action',
}: ButtonProps) => {
  const v = handleVariant(variant)

  return (
    <button
      className={
        className +
        ' flex font-medium items-center justify-center px-4 py-1 relative rounded text-sm transition-colors whitespace-nowrap ' +
        v
      }
      disabled={disabled}
      onClick={onClick}
      onMouseDown={onMouseDown}
      type={type}
    >
      {children}
    </button>
  )
}

export default Button
