'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 BaseLink = _styledComponents2.default.a.withConfig({
  displayName: 'Link__BaseLink'
})(['font-family:\'Montserrat\',sans-serif;font-size:', ';font-weight:', ';color:', ';text-transform:', ';text-decoration:none;cursor:pointer;&:hover{color:', ';}&:focus{text-decoration:none;}'], function (props) {
  return props.size;
}, function (props) {
  return props.weight;
}, function (props) {
  return props.theme[props.color];
}, function (props) {
  return props.uppercase ? 'uppercase' : props.capitalize ? 'capitalize' : 'none';
}, function (props) {
  return props.theme[props.color];
});

var Link = function Link(props) {
  var children = props.children,
      rest = _objectWithoutProperties(props, ['children']);

  return _react2.default.createElement(
    BaseLink,
    rest,
    children
  );
};

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

Link.defaultProps = {
  weight: 400,
  size: '16px',
  color: 'brand-secondary',
  uppercase: false,
  capitalize: false,
  bold: false
};

exports.default = Link;