import React, { Component } from 'react';

require("./IconButton.scss");

export default (props) => {
    let { title, size, disabled, icon, iconName, onClick } = props;
    let iconSpan = null;

    if (icon || iconName) {
        iconSpan = <span className={ `icon ${iconName || ""}` }>{ icon }</span>
    }

    return (
        <button className={ `icon-button ${size || ""}` } disabled={ disabled } onClick={ onClick }>
            { iconSpan }
            { title }
        </button>
    );

}