'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: 'ModalFooter__Wrapper'
})(['position:relative;display:flex;flex-direction:row;justify-content:flex-start;align-items:center;width:100%;padding:20px 30px;box-sizing:border-box;border-top:1px solid ', ';'], function (props) {
  return props.theme['gray-1'];
});
var Footer = _styledComponents2.default.div.withConfig({
  displayName: 'ModalFooter__Footer'
})(['display:flex;flex-direction:row;justify-content:', ';align-items:center;width:100%;'], function (props) {
  return props.alignment;
});

var selectAlignment = function selectAlignment(align) {
  switch (align) {
    case 'left':
      return 'flex-start';
    case 'right':
      return 'flex-end';
    case 'center':
      return 'center';
    case 'spaced':
      return 'space-between';
    default:
      return '';
  }
};

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

  var alignment = selectAlignment(align);
  return _react2.default.createElement(
    Wrapper,
    null,
    _react2.default.createElement(
      Footer,
      { alignment: alignment },
      children
    )
  );
};

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

ModalFooter.defaultProps = {
  align: 'left'
};

exports.default = ModalFooter;