'use strict';

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

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _dec, _class, _class2, _temp;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

var _propTypes2 = _interopRequireDefault(_propTypes);

var _lib = require('@instructure/ui-themeable/lib');

var _lib2 = _interopRequireDefault(_lib);

var _SidebarItem = require('../../../../../common/components/layout/sidebar/SidebarItem');

var _SidebarItem2 = _interopRequireDefault(_SidebarItem);

var _Pin = require('../../../../../common/components/Pin');

var _Pin2 = _interopRequireDefault(_Pin);

var _theme = require('./theme');

var _theme2 = _interopRequireDefault(_theme);

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

var styles = {
  template: function template(theme) {
    return '/*  imported from styles.css  */\n\n.SidebarItem__styles__itemWrapper {\n  position: relative;\n}\n\n.SidebarItem__styles__unansweredDot {\n  width: ' + theme.dotSize + ';\n  height: ' + theme.dotSize + ';\n  background: ' + theme.dotBackgroundColor + ';\n  border-radius: 50%;\n\n  position: absolute;\n  top: 50%;\n  left: calc(' + theme.dotSize + ' / -2);\n  margin-top: -0.3rem;\n}\n';
  },
  'itemWrapper': 'SidebarItem__styles__itemWrapper',
  'unansweredDot': 'SidebarItem__styles__unansweredDot'
};
var TakingSidebarItem = (_dec = (0, _lib2.default)(_theme2.default, styles), _dec(_class = (_temp = _class2 = function (_Component) {
  (0, _inherits3.default)(TakingSidebarItem, _Component);

  function TakingSidebarItem() {
    (0, _classCallCheck3.default)(this, TakingSidebarItem);
    return (0, _possibleConstructorReturn3.default)(this, (TakingSidebarItem.__proto__ || Object.getPrototypeOf(TakingSidebarItem)).apply(this, arguments));
  }

  (0, _createClass3.default)(TakingSidebarItem, [{
    key: 'renderPin',
    value: function renderPin() {
      var _props = this.props,
          isPinned = _props.isPinned,
          position = _props.position,
          pinSessionItem = _props.pinSessionItem;

      return _react2.default.createElement(_Pin2.default, {
        isPinned: isPinned,
        pinSessionItem: pinSessionItem(isPinned),
        position: position,
        variant: 'icon'
      });
    }
  }, {
    key: 'render',
    value: function render() {
      return _react2.default.createElement(
        'div',
        { className: styles.itemWrapper },
        !this.props.isAnswered && _react2.default.createElement('div', { className: styles.unansweredDot }),
        _react2.default.createElement(
          _SidebarItem2.default,
          {
            itemBody: this.props.itemBody,
            itemId: this.props.quizEntryId,
            itemName: this.props.itemName,
            inStimulus: this.props.inStimulus,
            pointsPossible: this.props.pointsPossible,
            position: this.props.position,
            scrollToItem: this.props.scrollToItem,
            sidebarOpen: this.props.sidebarOpen
          },
          this.renderPin()
        )
      );
    }
  }]);
  TakingSidebarItem.displayName = 'TakingSidebarItem'
  ;
  return TakingSidebarItem;
}(_react.Component), _class2.propTypes = {
  // Passed in by the Sidebar
  inStimulus: _propTypes2.default.bool,
  itemBody: _propTypes2.default.string.isRequired,
  itemName: _propTypes2.default.string.isRequired,
  pointsPossible: _propTypes2.default.number.isRequired,
  position: _propTypes2.default.number.isRequired,
  quizEntryId: _propTypes2.default.string.isRequired,
  scrollToItem: _propTypes2.default.func.isRequired,
  sidebarOpen: _propTypes2.default.bool.isRequired,
  // Passes in by connect
  isAnswered: _propTypes2.default.bool.isRequired,
  isPinned: _propTypes2.default.bool.isRequired,
  pinSessionItem: _propTypes2.default.func.isRequired
}, _class2.defaultProps = {
  inStimulus: false
}, _temp)) || _class);
exports.default = TakingSidebarItem;