'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; };

require('../../styles/components/notification.css');

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

var _NotificationBadge = require('./NotificationBadge');

var _NotificationBadge2 = _interopRequireDefault(_NotificationBadge);

var _NotificationTray = require('./NotificationTray');

var _NotificationTray2 = _interopRequireDefault(_NotificationTray);

var _NotificationHeader = require('./NotificationHeader');

var _NotificationHeader2 = _interopRequireDefault(_NotificationHeader);

var _NotificationBody = require('./NotificationBody');

var _NotificationBody2 = _interopRequireDefault(_NotificationBody);

var _NotificationFooter = require('./NotificationFooter');

var _NotificationFooter2 = _interopRequireDefault(_NotificationFooter);

var _NotificationEmpty = require('./NotificationEmpty');

var _NotificationEmpty2 = _interopRequireDefault(_NotificationEmpty);

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 Notification = function Notification(props) {
  var children = props.children,
      notifications = props.notifications,
      onNotificationClicked = props.onNotificationClicked,
      onBackClicked = props.onBackClicked,
      onClearNotification = props.onClearNotification,
      onClearAll = props.onClearAll,
      selectedNotification = props.selectedNotification,
      rest = _objectWithoutProperties(props, ['children', 'notifications', 'onNotificationClicked', 'onBackClicked', 'onClearNotification', 'onClearAll', 'selectedNotification']);

  var notificationCount = notifications.length;

  var badge = _react2.default.createElement(Notification.Badge, {
    key: 'badge',
    size: 'small',
    notificationCount: notificationCount,
    onClick: function onClick() {
      return onNotificationClicked();
    }
  });
  var tray = _react2.default.createElement(
    Notification.Tray,
    { key: 'tray' },
    _react2.default.createElement(Notification.Header, {
      title: 'NOTIFICATIONS',
      selectedNotification: selectedNotification,
      notificationCount: notificationCount,
      onBackClicked: onBackClicked
    }),
    _react2.default.createElement(Notification.Body, {
      selectedNotification: selectedNotification,
      notifications: notifications,
      onNotificationClicked: onNotificationClicked,
      onClearNotification: onClearNotification
    }),
    _react2.default.createElement(Notification.Footer, {
      onClearAll: onClearAll,
      selectedNotification: selectedNotification,
      empty: !notificationCount
    })
  );

  return _react2.default.createElement(_semanticUiReact.Popup, _extends({
    trigger: badge,
    content: tray,
    on: 'click',
    position: 'bottom center',
    className: 'notificationPopup'
  }, rest));
};

Notification.Badge = _NotificationBadge2.default;
Notification.Tray = _NotificationTray2.default;
Notification.Header = _NotificationHeader2.default;
Notification.Body = _NotificationBody2.default;
Notification.Footer = _NotificationFooter2.default;
Notification.Empty = _NotificationEmpty2.default;

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