import React from 'react';
import { IconButtonButton, IconButtonIcon } from './IconButton.css';

const IconButton = (props: { icon: string, bgColor: string, title?: string, padding?: number, disabled?: boolean, displayText?: boolean, hideIcon?: boolean, customStyle?: any, onClick: () => void}) => {
  return (
    <IconButtonButton title={props.title} style={props.customStyle} isDisabled={props.disabled} bgColor={props.bgColor} onClick={props.onClick} padding={props.padding >= 0 ?props.padding:10} disabled={props.disabled}>
      { props.displayText && props.title}
      { props.icon && !props.hideIcon && <IconButtonIcon className={`fas fa-${props.icon}`} />}
    </IconButtonButton>
  );
};

export default IconButton;