'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _styledComponents = require('styled-components');

var _styledComponents2 = _interopRequireDefault(_styledComponents);

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

var _propTypes2 = _interopRequireDefault(_propTypes);

var _Colors = require('../Colors');

var _ramda = require('ramda');

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

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

var BaseText = _styledComponents2.default.div.withConfig({
  displayName: 'Text__BaseText'
})(['font-family:\'Montserrat\',sans-serif;font-weight:', ';font-size:', ';text-transform:', ';font-style:', ';color:', ';cursor:', ';flex-direction:', ';display:', ';opacity:', ';'], function (props) {
  return props.weight;
}, function (props) {
  return props.size;
}, function (props) {
  return props.uppercase ? 'uppercase' : props.capitalize ? 'capitalize' : 'none';
}, function (props) {
  return props.italic ? 'italic' : 'normal';
}, function (props) {
  return props.theme[props.color];
}, function (props) {
  return props.cursor;
}, function (props) {
  return props.flexRow ? 'row' : null;
}, function (props) {
  return props.flexRow ? 'flex' : 'block';
}, function (props) {
  return props.opacity;
});

var Text = function Text(_ref) {
  var children = _ref.children,
      props = _objectWithoutProperties(_ref, ['children']);

  return _react2.default.createElement(
    BaseText,
    props,
    children,
    ' '
  );
};

Text.propTypes = {
  weight: _propTypes2.default.oneOf([100, 200, 300, 400, 500, 600, 700, 800, 900]),
  size: _propTypes2.default.string,
  uppercase: _propTypes2.default.bool,
  capitalize: _propTypes2.default.bool,
  italic: _propTypes2.default.bool,
  color: _propTypes2.default.oneOf((0, _ramda.keysIn)((0, _Colors.Palette)())),
  altFont: _propTypes2.default.bool,
  cursor: _propTypes2.default.string,
  opacity: _propTypes2.default.number
};

Text.defaultProps = {
  weight: 400,
  size: '16px',
  uppercase: false,
  capitalize: false,
  italic: false,
  color: 'gray-5',
  altFont: false,
  cursor: 'inherit',
  opacity: 1
};

exports.default = Text;