'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 _reactFontawesome = require('react-fontawesome');

var _reactFontawesome2 = _interopRequireDefault(_reactFontawesome);

require('./Console.css');

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

var renderLogs = function renderLogs() {
  var logs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  return logs.map(function (log, i) {
    return _react2.default.createElement(
      'div',
      { key: 'div-' + i },
      _react2.default.createElement(
        'span',
        { key: 'span-' + i },
        log
      )
    );
  });
};

var Console = function Console(_ref) {
  var logs = _ref.logs,
      show = _ref.show,
      onToggleConsole = _ref.onToggleConsole,
      style = _ref.style;
  return _react2.default.createElement(
    'div',
    { className: 'console-container', style: style },
    _react2.default.createElement(
      'div',
      { className: 'console-close', id: 'console-close', onClick: onToggleConsole },
      _react2.default.createElement(_reactFontawesome2.default, {
        name: show ? 'toggle-right' : 'toggle-left',
        className: show ? 'toggle-right' : 'toggle-left'
      })
    ),
    _react2.default.createElement(
      'div',
      { className: 'console-title' },
      'Console'
    ),
    _react2.default.createElement(
      'div',
      null,
      renderLogs(logs)
    )
  );
};

Console.propTypes = {
  style: _propTypes2.default.object,
  logs: _propTypes2.default.array,
  show: _propTypes2.default.bool,
  onToggleConsole: _propTypes2.default.func
};

exports.default = Console;