'use strict';

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

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

var _propTypes2 = _interopRequireDefault(_propTypes);

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

var _styledComponents2 = _interopRequireDefault(_styledComponents);

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

var Wrapper = _styledComponents2.default.div.withConfig({
  displayName: 'Separator__Wrapper'
})(['display:flex;flex-direction:row;justify-content:space-between;align-items:center;width:100%;']);
var Content = _styledComponents2.default.div.withConfig({
  displayName: 'Separator__Content'
})(['display:flex;flex-direction:row;justify-content:flex-start;align-items:center;white-space:nowrap;padding-left:', ';padding-right:', ';'], function (props) {
  return props.align === 'left' || props.align === 'center' ? '10px' : '0';
}, function (props) {
  return props.align === 'right' || props.align === 'center' ? '10px' : '0';
});
var BaseSeparator = _styledComponents2.default.div.withConfig({
  displayName: 'Separator__BaseSeparator'
})(['width:100%;height:1px;background-color:', ';margin:', ';'], function (props) {
  return props.theme['gray-2'];
}, function (props) {
  return props.margin ? props.margin : '10px 0';
});

var Separator = function Separator(props) {
  var children = props.children,
      align = props.align;


  return children ? _react2.default.createElement(
    Wrapper,
    null,
    align !== 'right' && _react2.default.createElement(BaseSeparator, { margin: props.margin }),
    _react2.default.createElement(
      Content,
      { align: align },
      children
    ),
    align !== 'left' && _react2.default.createElement(BaseSeparator, { margin: props.margin })
  ) : _react2.default.createElement(BaseSeparator, null);
};

Separator.propTypes = {
  align: _propTypes2.default.oneOf(['left', 'right', 'center'])
};

Separator.defaultProps = {
  align: 'center'
};

exports.default = Separator;