'use strict';

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

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _flexboxReact = require('flexbox-react');

var _flexboxReact2 = _interopRequireDefault(_flexboxReact);

var _semanticUiReact = require('semantic-ui-react');

var _getAlertIconClassName = require('../../util/getAlertIconClassName');

var _moment = require('moment');

var _moment2 = _interopRequireDefault(_moment);

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

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

var NotificationDetail = function NotificationDetail(props) {
  var notification = props.notification,
      onClearNotification = props.onClearNotification,
      rest = _objectWithoutProperties(props, ['notification', 'onClearNotification']);

  var id = notification.id,
      type = notification.type,
      title = notification.title,
      description = notification.description,
      timeStamp = notification.timeStamp;

  var icon = (0, _getAlertIconClassName.getAlertIconClassName)(type);

  function handleClearClicked(e, notification) {
    onClearNotification(notification);
    e.stopPropagation();
  }

  return _react2.default.createElement(
    _flexboxReact2.default,
    _extends({
      id: id,
      flexDirection: 'column',
      flexGrow: 1,
      className: 'column detailView notification_detail'
    }, rest),
    _react2.default.createElement(
      _flexboxReact2.default,
      { title: title },
      _react2.default.createElement(_semanticUiReact.Icon, { className: 'notificationIcon ' + type + ' ' + icon }),
      _react2.default.createElement(
        _flexboxReact2.default,
        { flexDirection: 'column', className: 'notificationContent' },
        _react2.default.createElement(
          'div',
          { className: 'notificationTitle' },
          title
        ),
        _react2.default.createElement(
          'div',
          { className: 'notificationTime' },
          '',
          (0, _moment2.default)(timeStamp).format('ddd MMM DD, YYYY, h:mm A'),
          ' '
        ),
        _react2.default.createElement(
          'div',
          { className: 'notificationDesc ' },
          description
        ),
        _react2.default.createElement(
          'div',
          { className: 'notificationActions' },
          _react2.default.createElement(
            'a',
            {
              className: 'notificationClear',
              onClick: function onClick(e) {
                return handleClearClicked(e, notification);
              }
            },
            'Clear'
          )
        )
      )
    )
  );
};

NotificationDetail.defaultProps = {};

NotificationDetail.propTypes = {};

exports.default = NotificationDetail;
//# sourceMappingURL=NotificationDetail.js.map