'use strict';

exports.__esModule = true;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

require('./style.css');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var ColoredHeading = function ColoredHeading(coloredHeading) {
  var Element = 'h' + coloredHeading.level;

  var classes = ['ma__colored-heading'];
  if (coloredHeading.color) {
    classes.push('ma__colored-heading--' + coloredHeading.color);
  }
  classes = classes.join(' ');

  return _react2.default.createElement(
    Element,
    { className: classes, tabIndex: '-1' },
    coloredHeading.text
  );
};

ColoredHeading.propTypes = process.env.NODE_ENV !== "production" ? {
  /** The heading text  */
  text: _propTypes2.default.string.isRequired,
  /** The heading level */
  level: _propTypes2.default.number,
  /** The color of the heading */
  color: _propTypes2.default.oneOf(['', 'green', 'blue'])
} : {};

ColoredHeading.defaultProps = {
  level: 2,
  color: ''
};

exports.default = ColoredHeading;
module.exports = exports['default'];