import classNames from 'classnames';
import React, { PropTypes } from 'react';

export default function MainButton({ theme, label, active, onClick }) {
  return (
    <button
      className={
        classNames(
          'c-main-button',
          theme['c-main-button'],
          { 'c-main-button-active': active },
          { [theme['c-main-button-active']]: active },
        )
      }
      onClick={(event) => {
        event.preventDefault();
        onClick();
      }}
    >
      <span
        className={
          classNames(
            'c-main-button__icon-triangle',
            theme['c-main-button__icon-triangle'],
          )
        }
      />
      {label}
    </button>
  );
}

MainButton.propTypes = {
  theme: PropTypes.oneOfType([
    PropTypes.object,
    PropTypes.func,
  ]).isRequired,
  label: PropTypes.string,
  active: PropTypes.bool,
  onClick: PropTypes.func,
};
