'use strict';

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

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _reactIntl = require('react-intl');

var _reactRouter = require('react-router');

var _KeywordSearchFormContainer = require('../../containers/search/KeywordSearchFormContainer');

var _KeywordSearchFormContainer2 = _interopRequireDefault(_KeywordSearchFormContainer);

var _NavBar = require('../navigation/NavBar');

var _NavBar2 = _interopRequireDefault(_NavBar);

var _UserMenu = require('../user/UserMenu');

var _UserMenu2 = _interopRequireDefault(_UserMenu);

var _withConfig = require('../../enhancers/withConfig');

var _withConfig2 = _interopRequireDefault(_withConfig);

var _Banner = require('../../../styles/cspace-ui/Banner.css');

var _Banner2 = _interopRequireDefault(_Banner);

var _BannerMain = require('../../../styles/cspace-ui/BannerMain.css');

var _BannerMain2 = _interopRequireDefault(_BannerMain);

var _BannerRight = require('../../../styles/cspace-ui/BannerRight.css');

var _BannerRight2 = _interopRequireDefault(_BannerRight);

var _Logo = require('../../../styles/cspace-ui/Logo.css');

var _Logo2 = _interopRequireDefault(_Logo);

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

var messages = (0, _reactIntl.defineMessages)({
  name: {
    'id': 'app.name',
    'defaultMessage': 'CollectionSpace'
  },
  keywordSearchPlaceholder: {
    'id': 'keywordSearch.placeholder',
    'defaultMessage': 'Search keywords...'
  }
});

var propTypes = {
  intl: _reactIntl.intlShape,
  config: _react.PropTypes.object,
  username: _react.PropTypes.string.isRequired
};

function Header(props) {
  var intl = props.intl,
      config = props.config,
      username = props.username;


  var name = intl.formatMessage(messages.name);

  return _react2.default.createElement(
    'header',
    null,
    _react2.default.createElement(
      'div',
      { className: _Banner2.default.common },
      _react2.default.createElement(
        'div',
        { className: _BannerMain2.default.common },
        _react2.default.createElement(
          _reactRouter.Link,
          { to: '/', title: name },
          _react2.default.createElement('div', { className: _Logo2.default.common })
        ),
        _react2.default.createElement(_KeywordSearchFormContainer2.default, {
          intl: intl,
          config: config
        })
      ),
      _react2.default.createElement(
        'div',
        { className: _BannerRight2.default.common },
        _react2.default.createElement(_UserMenu2.default, { username: username })
      )
    ),
    _react2.default.createElement(_NavBar2.default, null)
  );
}

Header.propTypes = propTypes;

exports.default = (0, _reactIntl.injectIntl)((0, _withConfig2.default)(Header));